Skip to content

Commit

Permalink
particle, swimmer, walker tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
thowell committed Jan 20, 2024
1 parent c2fa9f0 commit d475767
Show file tree
Hide file tree
Showing 12 changed files with 245 additions and 188 deletions.
21 changes: 21 additions & 0 deletions mjpc/tasks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,27 @@ add_custom_target(
COMMAND patch -o ${CMAKE_CURRENT_BINARY_DIR}/humanoid/humanoid_modified.xml
${CMAKE_CURRENT_BINARY_DIR}/humanoid/humanoid.xml
<${CMAKE_CURRENT_SOURCE_DIR}/humanoid/humanoid.xml.patch
# particle
COMMAND ${CMAKE_COMMAND} -E copy
${dm_control_SOURCE_DIR}/dm_control/suite/point_mass.xml
${CMAKE_CURRENT_BINARY_DIR}/particle/particle.xml
COMMAND patch -o ${CMAKE_CURRENT_BINARY_DIR}/particle/particle_modified.xml
${CMAKE_CURRENT_BINARY_DIR}/particle/particle.xml
<${CMAKE_CURRENT_SOURCE_DIR}/particle/particle.xml.patch
# swimmer
COMMAND ${CMAKE_COMMAND} -E copy
${dm_control_SOURCE_DIR}/dm_control/suite/swimmer.xml
${CMAKE_CURRENT_BINARY_DIR}/swimmer/swimmer.xml
COMMAND patch -o ${CMAKE_CURRENT_BINARY_DIR}/swimmer/swimmer_modified.xml
${CMAKE_CURRENT_BINARY_DIR}/swimmer/swimmer.xml
<${CMAKE_CURRENT_SOURCE_DIR}/swimmer/swimmer.xml.patch
# walker
COMMAND ${CMAKE_COMMAND} -E copy
${dm_control_SOURCE_DIR}/dm_control/suite/walker.xml
${CMAKE_CURRENT_BINARY_DIR}/walker/walker.xml
COMMAND patch -o ${CMAKE_CURRENT_BINARY_DIR}/walker/walker_modified.xml
${CMAKE_CURRENT_BINARY_DIR}/walker/walker.xml
<${CMAKE_CURRENT_SOURCE_DIR}/walker/walker.xml.patch
COMMAND ${CMAKE_COMMAND} -E copy
${menagerie_SOURCE_DIR}/shadow_hand/right_hand.xml
${CMAKE_CURRENT_BINARY_DIR}/hand/right_hand.xml
Expand Down
5 changes: 3 additions & 2 deletions mjpc/tasks/humanoid/humanoid.xml.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
--- humanoid.xml 2024-01-20 14:42:53
+++ modified.xml 2024-01-13 20:29:11
diff --git a/humanoid_modified.xml b/humanoid_modified.xml
--- a/humanoid_modified.xml
+++ b/humanoid_modified.xml
@@ -1,202 +1,231 @@
-<mujoco model="humanoid">
- <include file="./common/skybox.xml"/>
Expand Down
36 changes: 0 additions & 36 deletions mjpc/tasks/particle/particle.xml

This file was deleted.

57 changes: 57 additions & 0 deletions mjpc/tasks/particle/particle.xml.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
diff --git a/particle_modified.xml b/particle_modified.xml
--- a/particle_modified.xml
+++ b/particle_modified.xml
@@ -1,9 +1,5 @@
-<mujoco model="planar point mass">
- <include file="./common/skybox.xml"/>
- <include file="./common/visual.xml"/>
- <include file="./common/materials.xml"/>
-
- <option timestep="0.02">
+<mujoco model="Particle">
+ <option timestep="0.01">
<flag contact="disable"/>
</option>

@@ -13,9 +9,12 @@
</default>

<worldbody>
+ <body name="goal" mocap="true" pos="0.25 0 0.01" quat="1 0 0 0">
+ <geom type="sphere" size=".01" contype="0" conaffinity="0" rgba="0 1 0 .5"/>
+ </body>
<light name="light" pos="0 0 1"/>
<camera name="fixed" pos="0 0 .75" quat="1 0 0 0"/>
- <geom name="ground" type="plane" pos="0 0 0" size=".3 .3 .1" material="grid"/>
+ <geom name="ground" type="plane" pos="0 0 0" size=".3 .3 .1" material="blue_grid"/>
<geom name="wall_x" type="plane" pos="-.3 0 .02" zaxis="1 0 0" size=".02 .3 .02" material="decoration"/>
<geom name="wall_y" type="plane" pos="0 -.3 .02" zaxis="0 1 0" size=".3 .02 .02" material="decoration"/>
<geom name="wall_neg_x" type="plane" pos=".3 0 .02" zaxis="-1 0 0" size=".02 .3 .02" material="decoration"/>
@@ -26,24 +25,12 @@
<joint name="root_x" type="slide" pos="0 0 0" axis="1 0 0" />
<joint name="root_y" type="slide" pos="0 0 0" axis="0 1 0" />
<geom name="pointmass" type="sphere" size=".01" material="self" mass=".3"/>
+ <site name="tip" pos="0 0 0" size="0.01"/>
</body>
-
- <geom name="target" pos="0 0 .01" material="target" type="sphere" size=".015"/>
</worldbody>

- <tendon>
- <fixed name="t1">
- <joint joint="root_x" coef="1"/>
- <joint joint="root_y" coef="0"/>
- </fixed>
- <fixed name="t2">
- <joint joint="root_x" coef="0"/>
- <joint joint="root_y" coef="1"/>
- </fixed>
- </tendon>
-
<actuator>
- <motor name="t1" tendon="t1"/>
- <motor name="t2" tendon="t2"/>
+ <motor name="x_motor" joint="root_x" gear="1" ctrllimited="true" ctrlrange="-1 1"/>
+ <motor name="y_motor" joint="root_y" gear="1" ctrllimited="true" ctrlrange="-1 1"/>
</actuator>
</mujoco>
3 changes: 2 additions & 1 deletion mjpc/tasks/particle/task.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<mujoco model="Particle Control">
<include file="../common.xml"/>
<include file="particle.xml" />
<!-- modified from: https://github.com/google-deepmind/dm_control/blob/main/dm_control/suite/point_mass.xml -->
<include file="particle_modified.xml" />

<size memory="10K"/>

Expand Down
3 changes: 2 additions & 1 deletion mjpc/tasks/particle/task_timevarying.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<mujoco model="Particle Control">
<include file="../common.xml"/>
<include file="particle.xml" />
<!-- modified from: https://github.com/google-deepmind/dm_control/blob/main/dm_control/suite/point_mass.xml -->
<include file="particle_modified.xml" />

<size memory="10K"/>

Expand Down
81 changes: 0 additions & 81 deletions mjpc/tasks/swimmer/swimmer.xml

This file was deleted.

110 changes: 110 additions & 0 deletions mjpc/tasks/swimmer/swimmer.xml.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
diff --git a/swimmer_modified.xml b/swimmer_modified.xml
--- a/swimmer_modified.xml
+++ b/swimmer_modified.xml
@@ -1,38 +1,35 @@
<mujoco model="swimmer">
- <include file="./common/visual.xml"/>
- <include file="./common/skybox.xml"/>
- <include file="./common/materials.xml"/>
-
- <option timestep="0.002" density="3000">
+ <option timestep="0.01" integrator="implicit" density="1000">
<flag contact="disable"/>
</option>

<default>
<default class="swimmer">
- <joint type="hinge" pos="0 -.05 0" axis="0 0 1" limited="true" solreflimit=".05 1" solimplimit="0 .8 .1" armature="1e-6"/>
+ <joint type="hinge" pos="0 -.05 0" axis="0 0 1" limited="true" solreflimit=".05 .3"
+ solimplimit="0 .8 .1" armature="1e-6" range="-90 90" stiffness=".001"/>
<default class="inertial">
- <geom type="box" size=".001 .05 .01" rgba="0 0 0 0" mass=".01"/>
+ <geom type="box" size=".001 .05 .01" material="self" mass=".01" group="3"/>
</default>
<default class="visual">
- <geom type="capsule" size=".01" fromto="0 -.05 0 0 .05 0" material="self" mass="0"/>
+ <geom type="capsule" size=".01" fromto="0 -.05 0 0 .05 0" mass="0" material="self"/>
</default>
<site size=".01" rgba="0 0 0 0"/>
</default>
<default class="free">
<joint limited="false" stiffness="0" armature="0"/>
</default>
- <motor gear="5e-4" ctrllimited="true" ctrlrange="-1 1"/>
+ <general gainprm="2e-3" ctrllimited="true" ctrlrange="-1 1" dyntype="filter" dynprm="0.6"/>
</default>

<worldbody>
- <geom name="ground" type="plane" size="2 2 0.1" material="grid"/>
+ <geom name="ground" type="plane" size="2 2 0.01" material="blue_grid"/>
<body name="head" pos="0 0 .05" childclass="swimmer">
<light name="light_1" diffuse=".8 .8 .8" pos="0 0 1.5"/>
- <geom name="head" type="ellipsoid" size=".02 .04 .017" pos="0 -.022 0" material="self" mass="0"/>
- <geom name="nose" type="sphere" pos="0 -.06 0" size=".004" material="effector" mass="0"/>
- <geom name="eyes" type="capsule" fromto="-.006 -.054 .005 .006 -.054 .005" size=".004" material="eye" mass="0"/>
- <camera name="tracking1" pos="0 -.2 .5" xyaxes="1 0 0 0 1 1" mode="trackcom" fovy="60"/>
- <camera name="tracking2" pos="-.9 .5 .15" xyaxes="0 -1 0 .3 0 1" mode="trackcom" fovy="60"/>
+ <geom name="head" type="ellipsoid" size=".02 .04 .017" pos="0 -.022 0" mass="0" material="self"/>
+ <geom name="nose" type="sphere" pos="0 -.06 0" size=".004" mass="0" material="effector" euler="180 0 0"/>
+ <geom name="eyes" type="capsule" fromto="-.006 -.054 .005 .006 -.054 .005" size=".004" mass="0" material="eye"/>
+ <camera name="tracking1" pos="0.0 -0.2 0.5" xyaxes="1 0 0 0 1 1" mode="trackcom" fovy="60"/>
+ <camera name="tracking2" pos="-0.9 0.5 0.15" xyaxes="0 -1 0 .3 0 1" mode="trackcom" fovy="60"/>
<camera name="eyes" pos="0 -.058 .005" xyaxes="-1 0 0 0 0 1"/>
<joint name="rootx" class="free" type="slide" axis="1 0 0" pos="0 -.05 0"/>
<joint name="rooty" class="free" type="slide" axis="0 1 0" pos="0 -.05 0"/>
@@ -40,18 +37,45 @@
<geom name="inertial" class="inertial"/>
<geom name="visual" class="visual"/>
<site name="head"/>
+ <body name="segment_0" pos="0 .1 0">
+ <geom class="visual" name="visual_0"/>
+ <geom class="inertial" name="inertial_0"/>
+ <site name="site_0"/>
+ <joint name="joint_0"/>
+ <body name="segment_1" pos="0 .1 0">
+ <geom class="visual" name="visual_1"/>
+ <geom class="inertial" name="inertial_1"/>
+ <site name="site_1"/>
+ <joint name="joint_1"/>
+ <body name="segment_2" pos="0 .1 0">
+ <geom class="visual" name="visual_2"/>
+ <geom class="inertial" name="inertial_2"/>
+ <site name="site_2"/>
+ <joint name="joint_2"/>
+ <body name="segment_3" pos="0 .1 0">
+ <geom class="visual" name="visual_3"/>
+ <geom class="inertial" name="inertial_3"/>
+ <site name="site_3"/>
+ <joint name="joint_3"/>
+ <body name="segment_4" pos="0 .1 0">
+ <geom class="visual" name="visual_4"/>
+ <geom class="inertial" name="inertial_4"/>
+ <site name="site_4"/>
+ <joint name="joint_4"/>
+ </body>
+ </body>
+ </body>
+ </body>
+ </body>
</body>
- <geom name="target" type="sphere" pos="1 1 .05" size=".1" material="target"/>
- <light name="target_light" diffuse="1 1 1" pos="1 1 1.5"/>
</worldbody>

- <sensor>
- <framepos name="nose_pos" objtype="geom" objname="nose"/>
- <framepos name="target_pos" objtype="geom" objname="target"/>
- <framexaxis name="head_xaxis" objtype="xbody" objname="head"/>
- <frameyaxis name="head_yaxis" objtype="xbody" objname="head"/>
- <velocimeter name="head_vel" site="head"/>
- <gyro name="head_gyro" site="head"/>
- </sensor>
+ <actuator>
+ <general name="0" joint="joint_0"/>
+ <general name="1" joint="joint_1"/>
+ <general name="2" joint="joint_2"/>
+ <general name="3" joint="joint_3"/>
+ <general name="4" joint="joint_4"/>
+ </actuator>

</mujoco>
3 changes: 2 additions & 1 deletion mjpc/tasks/swimmer/task.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<mujoco model="Swimmer">
<include file="../common.xml" />
<include file="swimmer.xml" />
<!-- modified from: https://github.com/google-deepmind/dm_control/blob/main/dm_control/suite/swimmer.xml -->
<include file="swimmer_modified.xml" />

<custom>
<!-- agent -->
Expand Down
3 changes: 2 additions & 1 deletion mjpc/tasks/walker/task.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<mujoco model="Walker Locomotion">
<include file="../common.xml"/>
<include file="walker.xml" />
<!-- modified from: https://github.com/google-deepmind/dm_control/blob/main/dm_control/suite/walker.xml -->
<include file="walker_modified.xml" />

<size memory="100K"/>

Expand Down
Loading

0 comments on commit d475767

Please sign in to comment.