From 8becea255634e152bb4d920a8455cb726880e02a Mon Sep 17 00:00:00 2001 From: Kallinteris Andreas <30759571+Kallinteris-Andreas@users.noreply.github.com> Date: Sat, 21 Oct 2023 17:09:49 +0300 Subject: [PATCH 1/7] restore render support for `mujoco<3` --- gymnasium/envs/mujoco/mujoco_rendering.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gymnasium/envs/mujoco/mujoco_rendering.py b/gymnasium/envs/mujoco/mujoco_rendering.py index e5e45b875..859be73a5 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) ) From b826380da8d5feae2252224147cabfbc7d3c766d Mon Sep 17 00:00:00 2001 From: Kallinteris Andreas <30759571+Kallinteris-Andreas@users.noreply.github.com> Date: Sat, 21 Oct 2023 17:11:08 +0300 Subject: [PATCH 2/7] Update pyproject.toml --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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", From df00bf1d9b8ffe2075e6f942dc12c84dbdbbd5f7 Mon Sep 17 00:00:00 2001 From: Kallinteris Andreas <30759571+Kallinteris-Andreas@users.noreply.github.com> Date: Sat, 21 Oct 2023 17:12:35 +0300 Subject: [PATCH 3/7] Update mujoco_rendering.py --- gymnasium/envs/mujoco/mujoco_rendering.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/gymnasium/envs/mujoco/mujoco_rendering.py b/gymnasium/envs/mujoco/mujoco_rendering.py index 859be73a5..420dff5f7 100644 --- a/gymnasium/envs/mujoco/mujoco_rendering.py +++ b/gymnasium/envs/mujoco/mujoco_rendering.py @@ -618,9 +618,6 @@ def _create_overlay(self): 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) - ) self.add_overlay( bottomleft, "Step", str(round(self.data.time / self.model.opt.timestep)) ) From 5b743fc07501ed99b96d4b283a62de41eba81e35 Mon Sep 17 00:00:00 2001 From: Kallinteris Andreas <30759571+Kallinteris-Andreas@users.noreply.github.com> Date: Sat, 21 Oct 2023 17:13:48 +0300 Subject: [PATCH 4/7] typo fix --- gymnasium/envs/mujoco/mujoco_rendering.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gymnasium/envs/mujoco/mujoco_rendering.py b/gymnasium/envs/mujoco/mujoco_rendering.py index 420dff5f7..96b98df1b 100644 --- a/gymnasium/envs/mujoco/mujoco_rendering.py +++ b/gymnasium/envs/mujoco/mujoco_rendering.py @@ -616,8 +616,8 @@ def _create_overlay(self): ) 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) + ) self.add_overlay( bottomleft, "Step", str(round(self.data.time / self.model.opt.timestep)) ) From 2465aa2a664f1bf4576ca6ab278f9bd0353d6e89 Mon Sep 17 00:00:00 2001 From: Kallinteris Andreas <30759571+Kallinteris-Andreas@users.noreply.github.com> Date: Sun, 22 Oct 2023 21:49:44 +0300 Subject: [PATCH 5/7] Update mujoco_rendering.py --- gymnasium/envs/mujoco/mujoco_rendering.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gymnasium/envs/mujoco/mujoco_rendering.py b/gymnasium/envs/mujoco/mujoco_rendering.py index 96b98df1b..4e6f9d309 100644 --- a/gymnasium/envs/mujoco/mujoco_rendering.py +++ b/gymnasium/envs/mujoco/mujoco_rendering.py @@ -610,14 +610,17 @@ 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": + 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) + ) + self.add_overlay( + bottomleft, "Solver iterations", str(self.data.solver_niter[0] + 1) + ) self.add_overlay( bottomleft, "Step", str(round(self.data.time / self.model.opt.timestep)) ) From ec3ec1f46abf87e22b066f9573df09baf9602362 Mon Sep 17 00:00:00 2001 From: Kallinteris Andreas <30759571+Kallinteris-Andreas@users.noreply.github.com> Date: Mon, 23 Oct 2023 09:39:45 +0300 Subject: [PATCH 6/7] Update mujoco_rendering.py From fc226104dcae1068515ce8587e68da590b950db6 Mon Sep 17 00:00:00 2001 From: Kallinteris Andreas <30759571+Kallinteris-Andreas@users.noreply.github.com> Date: Mon, 23 Oct 2023 10:08:45 +0300 Subject: [PATCH 7/7] Update mujoco_rendering.py --- gymnasium/envs/mujoco/mujoco_rendering.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gymnasium/envs/mujoco/mujoco_rendering.py b/gymnasium/envs/mujoco/mujoco_rendering.py index 4e6f9d309..27593fde3 100644 --- a/gymnasium/envs/mujoco/mujoco_rendering.py +++ b/gymnasium/envs/mujoco/mujoco_rendering.py @@ -616,8 +616,8 @@ def _create_overlay(self): ) 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) + ) self.add_overlay( bottomleft, "Solver iterations", str(self.data.solver_niter[0] + 1) )