Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Fix] Small fixes for new mujoco release 3.0.0 #746

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions gymnasium/envs/mujoco/assets/swimmer.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<mujoco model="swimmer">
<compiler angle="degree" coordinate="local" inertiafromgeom="true"/>
<option collision="predefined" density="4000" integrator="RK4" timestep="0.01" viscosity="0.1"/>
<option density="4000" integrator="RK4" timestep="0.01" viscosity="0.1"/>
<default>
<geom conaffinity="1" condim="1" contype="1" material="geom" rgba="0.8 0.6 .4 1"/>
<geom conaffinity="0" condim="1" contype="0" material="geom" rgba="0.8 0.6 .4 1"/>
<joint armature='0.1' />
</default>
<asset>
Expand All @@ -14,7 +14,7 @@
</asset>
<worldbody>
<light cutoff="100" diffuse="1 1 1" dir="-0 0 -1.3" directional="true" exponent="1" pos="0 0 1.3" specular=".1 .1 .1"/>
<geom conaffinity="1" condim="3" material="MatPlane" name="floor" pos="0 0 -0.1" rgba="0.8 0.9 0.8 1" size="40 40 0.1" type="plane"/>
<geom condim="3" material="MatPlane" name="floor" pos="0 0 -0.1" rgba="0.8 0.9 0.8 1" size="40 40 0.1" type="plane"/>
<!-- ================= SWIMMER ================= /-->
<body name="torso" pos="0 0 0">
<camera name="track" mode="trackcom" pos="0 -3 3" xyaxes="1 0 0 0 1 1"/>
Expand Down
2 changes: 1 addition & 1 deletion gymnasium/envs/mujoco/mujoco_rendering.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ def _create_overlay(self):

self.add_overlay(bottomleft, "FPS", "%d%s" % (1 / self._time_per_render, ""))
self.add_overlay(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is possible to maintain support for both pre 3.0 and post 3.0 mujoco (which is important for reproducibility), by doing this

if mujoco.__version__ => "3.0.0":
    self.add_overlay(
        bottomleft, "Solver iterations", str(self.data.solver_niter[0] + 1)
    )
elif mujoco.__version__ < "3.0.0":
    self.add_overlay(
        bottomleft, "Solver iterations", str(self.data.solver_iter + 1)
    )

bottomleft, "Solver iterations", str(self.data.solver_iter + 1)
bottomleft, "Solver iterations", str(self.data.solver_niter[0] + 1)
)
self.add_overlay(
bottomleft, "Step", str(round(self.data.time / self.model.opt.timestep))
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ classic-control = ["pygame >=2.1.3"]
classic_control = ["pygame >=2.1.3"] # kept for backward compatibility
mujoco-py = ["mujoco-py >=2.1,<2.2", "cython<3"]
mujoco_py = ["mujoco-py >=2.1,<2.2", "cython<3"] # kept for backward compatibility
mujoco = ["mujoco >=2.3.3", "imageio >=2.14.1"]
mujoco = ["mujoco >=3.0.0", "imageio >=2.14.1"]
toy-text = ["pygame >=2.1.3"]
toy_text = ["pygame >=2.1.3"] # kept for backward compatibility
jax = ["jax >=0.4.0", "jaxlib >=0.4.0"]
Expand All @@ -67,7 +67,7 @@ all = [
"mujoco-py >=2.1,<2.2",
"cython<3",
# mujoco
"mujoco >=2.3.3",
"mujoco >=3.0.0",
"imageio >=2.14.1",
# toy-text
"pygame >=2.1.3",
Expand Down
Loading