diff --git a/gymnasium/envs/mujoco/mujoco_rendering.py b/gymnasium/envs/mujoco/mujoco_rendering.py index e5e45b875..27593fde3 100644 --- a/gymnasium/envs/mujoco/mujoco_rendering.py +++ b/gymnasium/envs/mujoco/mujoco_rendering.py @@ -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) ) diff --git a/pyproject.toml b/pyproject.toml index b4fb30632..208f9b03e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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"] @@ -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",