Skip to content

Commit

Permalink
restore render support for mujoco<3 (#750)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kallinteris-Andreas authored Oct 23, 2023
1 parent 0058eeb commit db18efb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions gymnasium/envs/mujoco/mujoco_rendering.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,14 @@ def _create_overlay(self):
self.add_overlay(topleft, "Toggle geomgroup visibility", "0-4")

self.add_overlay(bottomleft, "FPS", "%d%s" % (1 / self._time_per_render, ""))
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)
)
self.add_overlay(
bottomleft, "Solver iterations", str(self.data.solver_niter[0] + 1)
)
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 >=3.0.0", "imageio >=2.14.1"]
mujoco = ["mujoco >=2.1.5", "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 >=3.0.0",
"mujoco >=2.1.5",
"imageio >=2.14.1",
# toy-text
"pygame >=2.1.3",
Expand Down

0 comments on commit db18efb

Please sign in to comment.