Skip to content

Commit d475767

Browse files
committed
particle, swimmer, walker tasks
1 parent c2fa9f0 commit d475767

File tree

12 files changed

+245
-188
lines changed

12 files changed

+245
-188
lines changed

mjpc/tasks/CMakeLists.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,27 @@ add_custom_target(
3939
COMMAND patch -o ${CMAKE_CURRENT_BINARY_DIR}/humanoid/humanoid_modified.xml
4040
${CMAKE_CURRENT_BINARY_DIR}/humanoid/humanoid.xml
4141
<${CMAKE_CURRENT_SOURCE_DIR}/humanoid/humanoid.xml.patch
42+
# particle
43+
COMMAND ${CMAKE_COMMAND} -E copy
44+
${dm_control_SOURCE_DIR}/dm_control/suite/point_mass.xml
45+
${CMAKE_CURRENT_BINARY_DIR}/particle/particle.xml
46+
COMMAND patch -o ${CMAKE_CURRENT_BINARY_DIR}/particle/particle_modified.xml
47+
${CMAKE_CURRENT_BINARY_DIR}/particle/particle.xml
48+
<${CMAKE_CURRENT_SOURCE_DIR}/particle/particle.xml.patch
49+
# swimmer
50+
COMMAND ${CMAKE_COMMAND} -E copy
51+
${dm_control_SOURCE_DIR}/dm_control/suite/swimmer.xml
52+
${CMAKE_CURRENT_BINARY_DIR}/swimmer/swimmer.xml
53+
COMMAND patch -o ${CMAKE_CURRENT_BINARY_DIR}/swimmer/swimmer_modified.xml
54+
${CMAKE_CURRENT_BINARY_DIR}/swimmer/swimmer.xml
55+
<${CMAKE_CURRENT_SOURCE_DIR}/swimmer/swimmer.xml.patch
56+
# walker
57+
COMMAND ${CMAKE_COMMAND} -E copy
58+
${dm_control_SOURCE_DIR}/dm_control/suite/walker.xml
59+
${CMAKE_CURRENT_BINARY_DIR}/walker/walker.xml
60+
COMMAND patch -o ${CMAKE_CURRENT_BINARY_DIR}/walker/walker_modified.xml
61+
${CMAKE_CURRENT_BINARY_DIR}/walker/walker.xml
62+
<${CMAKE_CURRENT_SOURCE_DIR}/walker/walker.xml.patch
4263
COMMAND ${CMAKE_COMMAND} -E copy
4364
${menagerie_SOURCE_DIR}/shadow_hand/right_hand.xml
4465
${CMAKE_CURRENT_BINARY_DIR}/hand/right_hand.xml

mjpc/tasks/humanoid/humanoid.xml.patch

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
--- humanoid.xml 2024-01-20 14:42:53
2-
+++ modified.xml 2024-01-13 20:29:11
1+
diff --git a/humanoid_modified.xml b/humanoid_modified.xml
2+
--- a/humanoid_modified.xml
3+
+++ b/humanoid_modified.xml
34
@@ -1,202 +1,231 @@
45
-<mujoco model="humanoid">
56
- <include file="./common/skybox.xml"/>

mjpc/tasks/particle/particle.xml

Lines changed: 0 additions & 36 deletions
This file was deleted.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
diff --git a/particle_modified.xml b/particle_modified.xml
2+
--- a/particle_modified.xml
3+
+++ b/particle_modified.xml
4+
@@ -1,9 +1,5 @@
5+
-<mujoco model="planar point mass">
6+
- <include file="./common/skybox.xml"/>
7+
- <include file="./common/visual.xml"/>
8+
- <include file="./common/materials.xml"/>
9+
-
10+
- <option timestep="0.02">
11+
+<mujoco model="Particle">
12+
+ <option timestep="0.01">
13+
<flag contact="disable"/>
14+
</option>
15+
16+
@@ -13,9 +9,12 @@
17+
</default>
18+
19+
<worldbody>
20+
+ <body name="goal" mocap="true" pos="0.25 0 0.01" quat="1 0 0 0">
21+
+ <geom type="sphere" size=".01" contype="0" conaffinity="0" rgba="0 1 0 .5"/>
22+
+ </body>
23+
<light name="light" pos="0 0 1"/>
24+
<camera name="fixed" pos="0 0 .75" quat="1 0 0 0"/>
25+
- <geom name="ground" type="plane" pos="0 0 0" size=".3 .3 .1" material="grid"/>
26+
+ <geom name="ground" type="plane" pos="0 0 0" size=".3 .3 .1" material="blue_grid"/>
27+
<geom name="wall_x" type="plane" pos="-.3 0 .02" zaxis="1 0 0" size=".02 .3 .02" material="decoration"/>
28+
<geom name="wall_y" type="plane" pos="0 -.3 .02" zaxis="0 1 0" size=".3 .02 .02" material="decoration"/>
29+
<geom name="wall_neg_x" type="plane" pos=".3 0 .02" zaxis="-1 0 0" size=".02 .3 .02" material="decoration"/>
30+
@@ -26,24 +25,12 @@
31+
<joint name="root_x" type="slide" pos="0 0 0" axis="1 0 0" />
32+
<joint name="root_y" type="slide" pos="0 0 0" axis="0 1 0" />
33+
<geom name="pointmass" type="sphere" size=".01" material="self" mass=".3"/>
34+
+ <site name="tip" pos="0 0 0" size="0.01"/>
35+
</body>
36+
-
37+
- <geom name="target" pos="0 0 .01" material="target" type="sphere" size=".015"/>
38+
</worldbody>
39+
40+
- <tendon>
41+
- <fixed name="t1">
42+
- <joint joint="root_x" coef="1"/>
43+
- <joint joint="root_y" coef="0"/>
44+
- </fixed>
45+
- <fixed name="t2">
46+
- <joint joint="root_x" coef="0"/>
47+
- <joint joint="root_y" coef="1"/>
48+
- </fixed>
49+
- </tendon>
50+
-
51+
<actuator>
52+
- <motor name="t1" tendon="t1"/>
53+
- <motor name="t2" tendon="t2"/>
54+
+ <motor name="x_motor" joint="root_x" gear="1" ctrllimited="true" ctrlrange="-1 1"/>
55+
+ <motor name="y_motor" joint="root_y" gear="1" ctrllimited="true" ctrlrange="-1 1"/>
56+
</actuator>
57+
</mujoco>

mjpc/tasks/particle/task.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<mujoco model="Particle Control">
22
<include file="../common.xml"/>
3-
<include file="particle.xml" />
3+
<!-- modified from: https://github.com/google-deepmind/dm_control/blob/main/dm_control/suite/point_mass.xml -->
4+
<include file="particle_modified.xml" />
45

56
<size memory="10K"/>
67

mjpc/tasks/particle/task_timevarying.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<mujoco model="Particle Control">
22
<include file="../common.xml"/>
3-
<include file="particle.xml" />
3+
<!-- modified from: https://github.com/google-deepmind/dm_control/blob/main/dm_control/suite/point_mass.xml -->
4+
<include file="particle_modified.xml" />
45

56
<size memory="10K"/>
67

mjpc/tasks/swimmer/swimmer.xml

Lines changed: 0 additions & 81 deletions
This file was deleted.
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
diff --git a/swimmer_modified.xml b/swimmer_modified.xml
2+
--- a/swimmer_modified.xml
3+
+++ b/swimmer_modified.xml
4+
@@ -1,38 +1,35 @@
5+
<mujoco model="swimmer">
6+
- <include file="./common/visual.xml"/>
7+
- <include file="./common/skybox.xml"/>
8+
- <include file="./common/materials.xml"/>
9+
-
10+
- <option timestep="0.002" density="3000">
11+
+ <option timestep="0.01" integrator="implicit" density="1000">
12+
<flag contact="disable"/>
13+
</option>
14+
15+
<default>
16+
<default class="swimmer">
17+
- <joint type="hinge" pos="0 -.05 0" axis="0 0 1" limited="true" solreflimit=".05 1" solimplimit="0 .8 .1" armature="1e-6"/>
18+
+ <joint type="hinge" pos="0 -.05 0" axis="0 0 1" limited="true" solreflimit=".05 .3"
19+
+ solimplimit="0 .8 .1" armature="1e-6" range="-90 90" stiffness=".001"/>
20+
<default class="inertial">
21+
- <geom type="box" size=".001 .05 .01" rgba="0 0 0 0" mass=".01"/>
22+
+ <geom type="box" size=".001 .05 .01" material="self" mass=".01" group="3"/>
23+
</default>
24+
<default class="visual">
25+
- <geom type="capsule" size=".01" fromto="0 -.05 0 0 .05 0" material="self" mass="0"/>
26+
+ <geom type="capsule" size=".01" fromto="0 -.05 0 0 .05 0" mass="0" material="self"/>
27+
</default>
28+
<site size=".01" rgba="0 0 0 0"/>
29+
</default>
30+
<default class="free">
31+
<joint limited="false" stiffness="0" armature="0"/>
32+
</default>
33+
- <motor gear="5e-4" ctrllimited="true" ctrlrange="-1 1"/>
34+
+ <general gainprm="2e-3" ctrllimited="true" ctrlrange="-1 1" dyntype="filter" dynprm="0.6"/>
35+
</default>
36+
37+
<worldbody>
38+
- <geom name="ground" type="plane" size="2 2 0.1" material="grid"/>
39+
+ <geom name="ground" type="plane" size="2 2 0.01" material="blue_grid"/>
40+
<body name="head" pos="0 0 .05" childclass="swimmer">
41+
<light name="light_1" diffuse=".8 .8 .8" pos="0 0 1.5"/>
42+
- <geom name="head" type="ellipsoid" size=".02 .04 .017" pos="0 -.022 0" material="self" mass="0"/>
43+
- <geom name="nose" type="sphere" pos="0 -.06 0" size=".004" material="effector" mass="0"/>
44+
- <geom name="eyes" type="capsule" fromto="-.006 -.054 .005 .006 -.054 .005" size=".004" material="eye" mass="0"/>
45+
- <camera name="tracking1" pos="0 -.2 .5" xyaxes="1 0 0 0 1 1" mode="trackcom" fovy="60"/>
46+
- <camera name="tracking2" pos="-.9 .5 .15" xyaxes="0 -1 0 .3 0 1" mode="trackcom" fovy="60"/>
47+
+ <geom name="head" type="ellipsoid" size=".02 .04 .017" pos="0 -.022 0" mass="0" material="self"/>
48+
+ <geom name="nose" type="sphere" pos="0 -.06 0" size=".004" mass="0" material="effector" euler="180 0 0"/>
49+
+ <geom name="eyes" type="capsule" fromto="-.006 -.054 .005 .006 -.054 .005" size=".004" mass="0" material="eye"/>
50+
+ <camera name="tracking1" pos="0.0 -0.2 0.5" xyaxes="1 0 0 0 1 1" mode="trackcom" fovy="60"/>
51+
+ <camera name="tracking2" pos="-0.9 0.5 0.15" xyaxes="0 -1 0 .3 0 1" mode="trackcom" fovy="60"/>
52+
<camera name="eyes" pos="0 -.058 .005" xyaxes="-1 0 0 0 0 1"/>
53+
<joint name="rootx" class="free" type="slide" axis="1 0 0" pos="0 -.05 0"/>
54+
<joint name="rooty" class="free" type="slide" axis="0 1 0" pos="0 -.05 0"/>
55+
@@ -40,18 +37,45 @@
56+
<geom name="inertial" class="inertial"/>
57+
<geom name="visual" class="visual"/>
58+
<site name="head"/>
59+
+ <body name="segment_0" pos="0 .1 0">
60+
+ <geom class="visual" name="visual_0"/>
61+
+ <geom class="inertial" name="inertial_0"/>
62+
+ <site name="site_0"/>
63+
+ <joint name="joint_0"/>
64+
+ <body name="segment_1" pos="0 .1 0">
65+
+ <geom class="visual" name="visual_1"/>
66+
+ <geom class="inertial" name="inertial_1"/>
67+
+ <site name="site_1"/>
68+
+ <joint name="joint_1"/>
69+
+ <body name="segment_2" pos="0 .1 0">
70+
+ <geom class="visual" name="visual_2"/>
71+
+ <geom class="inertial" name="inertial_2"/>
72+
+ <site name="site_2"/>
73+
+ <joint name="joint_2"/>
74+
+ <body name="segment_3" pos="0 .1 0">
75+
+ <geom class="visual" name="visual_3"/>
76+
+ <geom class="inertial" name="inertial_3"/>
77+
+ <site name="site_3"/>
78+
+ <joint name="joint_3"/>
79+
+ <body name="segment_4" pos="0 .1 0">
80+
+ <geom class="visual" name="visual_4"/>
81+
+ <geom class="inertial" name="inertial_4"/>
82+
+ <site name="site_4"/>
83+
+ <joint name="joint_4"/>
84+
+ </body>
85+
+ </body>
86+
+ </body>
87+
+ </body>
88+
+ </body>
89+
</body>
90+
- <geom name="target" type="sphere" pos="1 1 .05" size=".1" material="target"/>
91+
- <light name="target_light" diffuse="1 1 1" pos="1 1 1.5"/>
92+
</worldbody>
93+
94+
- <sensor>
95+
- <framepos name="nose_pos" objtype="geom" objname="nose"/>
96+
- <framepos name="target_pos" objtype="geom" objname="target"/>
97+
- <framexaxis name="head_xaxis" objtype="xbody" objname="head"/>
98+
- <frameyaxis name="head_yaxis" objtype="xbody" objname="head"/>
99+
- <velocimeter name="head_vel" site="head"/>
100+
- <gyro name="head_gyro" site="head"/>
101+
- </sensor>
102+
+ <actuator>
103+
+ <general name="0" joint="joint_0"/>
104+
+ <general name="1" joint="joint_1"/>
105+
+ <general name="2" joint="joint_2"/>
106+
+ <general name="3" joint="joint_3"/>
107+
+ <general name="4" joint="joint_4"/>
108+
+ </actuator>
109+
110+
</mujoco>

mjpc/tasks/swimmer/task.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<mujoco model="Swimmer">
22
<include file="../common.xml" />
3-
<include file="swimmer.xml" />
3+
<!-- modified from: https://github.com/google-deepmind/dm_control/blob/main/dm_control/suite/swimmer.xml -->
4+
<include file="swimmer_modified.xml" />
45

56
<custom>
67
<!-- agent -->

mjpc/tasks/walker/task.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<mujoco model="Walker Locomotion">
22
<include file="../common.xml"/>
3-
<include file="walker.xml" />
3+
<!-- modified from: https://github.com/google-deepmind/dm_control/blob/main/dm_control/suite/walker.xml -->
4+
<include file="walker_modified.xml" />
45

56
<size memory="100K"/>
67

0 commit comments

Comments
 (0)