Skip to content

Commit 2ba0a0a

Browse files
kevinzakkacopybara-github
authored andcommitted
[mujoco-playground] Allow dm_control suite tasks which use spec to construct the model to be backwards compatible with MuJoCo versions < 3.3.0.
PiperOrigin-RevId: 734620916 Change-Id: I0bb5181badbe0e1f433b3cb8870643f9c225d1ea
1 parent ce68474 commit 2ba0a0a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mujoco_playground/_src/dm_control_suite/reacher.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ def default_config() -> config_dict.ConfigDict:
4444

4545
def _make_model(xml_path: epath.Path, target_size: float) -> mujoco.MjModel:
4646
spec = mujoco.MjSpec.from_string(xml_path.read_text(), common.get_assets())
47-
target_body = spec.body("target")
47+
if mujoco.__version__ >= "3.3.0":
48+
target_body = spec.body("target")
49+
else:
50+
target_body = spec.find_body("target")
4851
target_geom = target_body.first_geom()
4952
target_geom.size[0] = target_size
5053
return spec.compile()

0 commit comments

Comments
 (0)