Skip to content

Commit c80cf60

Browse files
committed
acrobot task
1 parent 27de076 commit c80cf60

File tree

5 files changed

+59
-44
lines changed

5 files changed

+59
-44
lines changed

CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ set(MUJOCO_MPC_MENAGERIE_GIT_TAG
6565
CACHE STRING "Git revision for MuJoCo Menagerie."
6666
)
6767

68+
set(MUJOCO_MPC_DM_CONTROL_GIT_TAG
69+
774f46182140106e22725914aad3c6299ed91edd
70+
CACHE STRING "Git revision for dm_control."
71+
)
72+
6873
findorfetch(
6974
USE_SYSTEM_PACKAGE
7075
OFF
@@ -177,6 +182,17 @@ if(NOT menagerie_POPULATED)
177182
FetchContent_Populate(menagerie)
178183
endif()
179184

185+
FetchContent_Declare(
186+
dm_control
187+
GIT_REPOSITORY https://github.com/google-deepmind/dm_control.git
188+
GIT_TAG ${MUJOCO_MPC_DM_CONTROL_GIT_TAG}
189+
)
190+
191+
FetchContent_GetProperties(dm_control)
192+
if(NOT dm_control_POPULATED)
193+
FetchContent_Populate(dm_control)
194+
endif()
195+
180196
if(NOT TARGET lodepng)
181197
FetchContent_Declare(
182198
lodepng

mjpc/tasks/CMakeLists.txt

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,16 @@
1616
# built binary.
1717

1818
add_custom_target(
19-
copy_menagerie_resources ALL
19+
copy_model_resources ALL
20+
## dm_control models
21+
# acrobot
22+
COMMAND ${CMAKE_COMMAND} -E copy
23+
${dm_control_SOURCE_DIR}/dm_control/suite/acrobot.xml
24+
${CMAKE_CURRENT_BINARY_DIR}/acrobot/acrobot.xml
25+
COMMAND patch -o ${CMAKE_CURRENT_BINARY_DIR}/acrobot/acrobot_modified.xml
26+
${CMAKE_CURRENT_BINARY_DIR}/acrobot/acrobot.xml
27+
<${CMAKE_CURRENT_SOURCE_DIR}/acrobot/acrobot.xml.patch
28+
2029
COMMAND ${CMAKE_COMMAND} -E copy
2130
${menagerie_SOURCE_DIR}/shadow_hand/right_hand.xml
2231
${CMAKE_CURRENT_BINARY_DIR}/hand/right_hand.xml
@@ -68,14 +77,14 @@ add_custom_target(
6877
COMMAND ${Python_EXECUTABLE}
6978
${CMAKE_CURRENT_BINARY_DIR}/manipulation/merge_panda_robotiq.py
7079
${CMAKE_CURRENT_BINARY_DIR}/manipulation/panda_robotiq.xml
71-
COMMENT "Copying menagerie assets into binary directory")
80+
COMMENT "Copying Menagerie and dm_control assets into binary directory")
7281

7382
add_custom_target(copy_resources ALL
7483
COMMAND ${CMAKE_COMMAND} -E copy_directory
7584
${CMAKE_CURRENT_SOURCE_DIR}
7685
${CMAKE_CURRENT_BINARY_DIR}
7786
COMMENT "Copying tasks into binary directory")
7887

79-
add_dependencies(copy_menagerie_resources copy_resources)
88+
add_dependencies(copy_model_resources copy_resources)
8089

81-
add_dependencies(mjpc copy_menagerie_resources)
90+
add_dependencies(mjpc copy_model_resources)

mjpc/tasks/acrobot/acrobot.xml

Lines changed: 0 additions & 39 deletions
This file was deleted.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
diff --git a/acrobot_modified.xml b/acrobot_modified.xml
2+
--- a/acrobot_modified.xml
3+
+++ b/acrobot_modified.xml
4+
@@ -6,22 +6,18 @@
5+
IEEE control systems 15, no. 1 (1995): 49-55.
6+
-->
7+
<mujoco model="acrobot">
8+
- <include file="./common/visual.xml"/>
9+
- <include file="./common/skybox.xml"/>
10+
- <include file="./common/materials.xml"/>
11+
-
12+
<default>
13+
<joint damping=".05"/>
14+
<geom type="capsule" mass="1"/>
15+
</default>
16+
17+
- <option timestep="0.01" integrator="RK4">
18+
+ <option timestep="0.01">
19+
<flag constraint="disable" energy="enable"/>
20+
</option>
21+
22+
<worldbody>
23+
<light name="light" pos="0 0 6"/>
24+
- <geom name="floor" size="3 3 .2" type="plane" material="grid"/>
25+
+ <geom name="floor" size="3 3 .2" type="plane" material="blue_grid"/>
26+
<site name="target" type="sphere" pos="0 0 4" size="0.2" material="target" group="3"/>
27+
<camera name="fixed" pos="0 -6 2" zaxis="0 -1 0"/>
28+
<camera name="lookat" mode="targetbodycom" target="upper_arm" pos="0 -2 3"/>

mjpc/tasks/acrobot/task.xml

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

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

0 commit comments

Comments
 (0)