Post

quickstart-mujoco-1-4-MJCF analysis for two example

1. MuJoCo Lec 1: Working with XML files

MuJoCo 200 Tutorials

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<mujoco>
  <compiler angle="radian"/>
  <visual>
    <headlight ambient=".3 .3 .3" />
  </visual>
  <asset>
	<material name="white" rgba="1 1 1 1"/>
  </asset>
  <option gravity="0 0 -9.8">
    <!-- <flag gravity="enable"/> -->
  </option>

  <worldbody>
    <light diffuse=".3 .3 .3" pos="0 0 3" dir="0 0 -1"/>
    <geom type="plane" size="1 1 .1" rgba="0 .9 0 1"/>
	<body pos=".2 0 2.3">
      <joint type="free"/>
	  <inertial pos="0 0 0" mass="1" diaginertia=".01 .01 .01"/>
      <geom type="sphere" size=".1" rgba="0 0 1 1"/>
    </body>
	<body pos="0 0 2" euler="0 -1.57 0">
      <joint type="free"/>
	  <inertial pos="0 0 0" mass="1" diaginertia=".01 .01 .01"/>
      <geom type="box" size=".1 .2 .3" rgba=".9 0 0 1"/>
    </body>
    <body pos="0 0 1" euler="0 0 0">
      <joint type="free"/>
	  <inertial pos="0 0 0" mass="1" diaginertia=".01 .01 .01"/>
	  <geom type="box" size=".1 .2 .3" material="white"/>
    </body>

  </worldbody>
</mujoco>

2. MJCF analysis for Panda

ref1 ref2

model

robosuite/models/assets/robots/panda/robot.xml example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<mujoco model="panda">
    <actuator>
        <!-- Physical limits of the actuator. -->
        <motor ctrllimited="true" ctrlrange="-80.0 80.0" joint="joint1" name="torq_j1"/>
        <motor ctrllimited="true" ctrlrange="-80.0 80.0" joint="joint2" name="torq_j2"/>
        <motor ctrllimited="true" ctrlrange="-80.0 80.0" joint="joint3" name="torq_j3"/>
        <motor ctrllimited="true" ctrlrange="-80.0 80.0" joint="joint4" name="torq_j4"/>
        <motor ctrllimited="true" ctrlrange="-80.0 80.0" joint="joint5" name="torq_j5"/>
        <motor ctrllimited="true" ctrlrange="-12.0 12.0" joint="joint6" name="torq_j6"/>
        <motor ctrllimited="true" ctrlrange="-12.0 12.0" joint="joint7" name="torq_j7"/>
    </actuator>
    <asset>
        <mesh name="link0" file="meshes/link0.stl" />
        <mesh name="link1" file="meshes/link1.stl" />
        <mesh name="link2" file="meshes/link2.stl" />
        <mesh name="link3" file="meshes/link3.stl" />
        <mesh name="link4" file="meshes/link4.stl" />
        <mesh name="link5" file="meshes/link5.stl" />
        <mesh name="link6" file="meshes/link6.stl" />
        <mesh name="link7" file="meshes/link7.stl" />
        <mesh name="link0_vis" file="meshes/link0_vis.stl" />
        <mesh name="link1_vis" file="meshes/link1_vis.stl" />
        <mesh name="link2_vis" file="meshes/link2_vis.stl" />
        <mesh name="link3_vis" file="meshes/link3_vis.stl" />
        <mesh name="link4_vis" file="meshes/link4_vis.stl" />
        <mesh name="link5_vis" file="meshes/link5_vis.stl" />
        <mesh name="link6_vis" file="meshes/link6_vis.stl" />
        <mesh name="link7_vis" file="meshes/link7_vis.stl" />
    </asset>
    <worldbody>
        <body name="base" pos="0 0 0">
            <!-- robot view -->
            <camera mode="fixed" name="robotview" pos="1.0 0 0.4" quat="0.653 0.271 0.271 0.653"/>
            <inertial diaginertia="0 0 0" mass="0" pos="0 0 0"/>
            <!-- mount attached here -->
            <body name="link0" pos="0 0 0">
                <inertial pos="0 0 0.05" mass="4" diaginertia="0.4 0.4 0.4" />
                <geom type="mesh" contype="0" conaffinity="0" group="1" mesh="link0_vis" name="link0_visual" rgba="1 1 1 1" />
                <geom type="mesh" group="0" mesh="link0" name="link0_collision"/>
                <body name="link1" pos="0 0 0.333">
                    <inertial pos="0 0 -0.07" mass="3" diaginertia="0.3 0.3 0.3" />
                    <joint name="joint1" pos="0 0 0" axis="0 0 1" limited="true" range="-2.8973 2.8973" damping="0.1"/>
                    <geom type="mesh" contype="0" conaffinity="0" group="1" mesh="link1_vis" name="link1_visual" rgba="1 1 1 1" />
                    <geom type="mesh" group="0" mesh="link1" name="link1_collision"/>
                    <body name="link2" pos="0 0 0" quat="0.707107 -0.707107 0 0">
                        <inertial pos="0 -0.1 0" mass="3" diaginertia="0.3 0.3 0.3" />
                        <joint name="joint2" pos="0 0 0" axis="0 0 1" limited="true" range="-1.7628 1.7628" damping="0.1"/>
                        <geom type="mesh" contype="0" conaffinity="0" group="1" mesh="link2_vis" name="link2_visual" rgba="1 1 1 1" />
                        <geom type="mesh" group="0" mesh="link2" name="link2_collision"/>
                        <body name="link3" pos="0 -0.316 0" quat="0.707107 0.707107 0 0">
                            <inertial pos="0.04 0 -0.05" mass="2" diaginertia="0.2 0.2 0.2" />
                            <joint name="joint3" pos="0 0 0" axis="0 0 1" limited="true" range="-2.8973 2.8973" damping="0.1"/>
                            <geom type="mesh" contype="0" conaffinity="0" group="1" mesh="link3_vis" name="link3_visual" rgba="1 1 1 1" />
                            <geom type="mesh" group="0" mesh="link3" name="link3_collision"/>
                            <body name="link4" pos="0.0825 0 0" quat="0.707107 0.707107 0 0">
                                <inertial pos="-0.04 0.05 0" mass="2" diaginertia="0.2 0.2 0.2" />
                                <joint name="joint4" pos="0 0 0" axis="0 0 1" limited="true" range="-3.0718 -0.0698" damping="0.1"/>
                                <geom type="mesh" contype="0" conaffinity="0" group="1" mesh="link4_vis" name="link4_visual" rgba="1 1 1 1" />
                                <geom type="mesh" group="0" mesh="link4" name="link4_collision"/>
                                <body name="link5" pos="-0.0825 0.384 0" quat="0.707107 -0.707107 0 0">
                                    <inertial pos="0 0 -0.15" mass="2" diaginertia="0.2 0.2 0.2" />
                                    <joint name="joint5" pos="0 0 0" axis="0 0 1" limited="true" range="-2.8973 2.8973" damping="0.1"/>
                                    <geom type="mesh" contype="0" conaffinity="0" group="1" mesh="link5_vis" name="link5_visual" rgba="1 1 1 1" />
                                    <geom type="mesh" group="0" mesh="link5" name="link5_collision"/>
                                    <body name="link6" pos="0 0 0" quat="0.707107 0.707107 0 0">
                                        <inertial pos="0.06 0 0" mass="1.5" diaginertia="0.1 0.1 0.1" />
                                        <joint name="joint6" pos="0 0 0" axis="0 0 1" limited="true" range="-0.0175 3.7525" damping="0.01"/>
                                        <geom type="mesh" contype="0" conaffinity="0" group="1" mesh="link6_vis" name="link6_visual" rgba="1 1 1 1" />
                                        <geom type="mesh" group="0" mesh="link6" name="link6_collision"/>
                                        <body name="link7" pos="0.088 0 0" quat="0.707107 0.707107 0 0">
                                            <inertial pos="0 0 0.08" mass="0.5" diaginertia="0.05 0.05 0.05" />
                                            <joint name="joint7" pos="0 0 0" axis="0 0 1" limited="true" range="-2.8973 2.8973" damping="0.01"/>
                                            <geom type="mesh" contype="0" conaffinity="0" group="1" mesh="link7_vis" name="link7_visual" rgba="1. 1. 1. 1." />
                                            <geom type="mesh" group="0" mesh="link7" name="link7_collision"/>
                                            <!-- rotate 135deg to align physically to the tool-->
                                            <body name="right_hand" pos="0 0 0.1065" quat="0.924 0 0 -0.383">
                                                <inertial pos="0 0 0" mass="0.5" diaginertia="0.05 0.05 0.05" />
                                                <!-- This camera points out from the eef. -->
                                                <camera mode="fixed" name="eye_in_hand" pos="0.05 0 0" quat="0 0.707108 0.707108 0" fovy="75"/>
                                                <!-- to add gripper -->
                                            </body>
                                        </body>
                                    </body>
                                </body>
                            </body>
                        </body>
                    </body>
                </body>
            </body>
        </body>
    </worldbody>
</mujoco>

robosuite/models/assets/base.xml:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!-- This is the base xml for all physics simulations. Set global configs here. -->
<mujoco model="base">
  <compiler angle="radian" meshdir="meshes/" inertiagrouprange="0 0" autolimits="true"/>
  <option impratio="20" cone="elliptic" density="1.2" viscosity="0.00002"/>
  <size nconmax="5000" njmax="5000"/>

  <asset>
  </asset>

  <visual>
    <map znear="0.001" />
  </visual>

  <actuator>
  </actuator>

  <worldbody>
  </worldbody>

  <equality>
  </equality>
</mujoco>
This post is licensed under CC BY 4.0 by the author.