Skip to content

Commit d35b92a

Browse files
committed
Add docstring for _legacy_add_marker_to_scene
1 parent 1ec4e29 commit d35b92a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

gymnasium/envs/mujoco/mujoco_rendering.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def _add_marker_to_scene(self, marker: dict):
9696
if self.scn.ngeom >= self.scn.maxgeom:
9797
raise RuntimeError(f"Ran out of geoms. maxgeom: {self.scn.maxgeom}")
9898

99-
if _MUJOCO_MARKER_LEGACY_MODE:
99+
if _MUJOCO_MARKER_LEGACY_MODE: # Old API for markers requires special handling
100100
self._legacy_add_marker_to_scene(marker)
101101
else:
102102
geom_type = marker.get("type", mujoco.mjtGeom.mjGEOM_SPHERE)
@@ -116,6 +116,15 @@ def _add_marker_to_scene(self, marker: dict):
116116
self.scn.ngeom += 1
117117

118118
def _legacy_add_marker_to_scene(self, marker: dict):
119+
"""Add a marker to the scene compatible with older versions of MuJoCo.
120+
121+
MuJoCo 3.2 introduced breaking changes to the visual geometries API. To maintain
122+
compatibility with older versions, we use the legacy API when an older version of MuJoCo is
123+
detected.
124+
125+
Args:
126+
marker: A dictionary containing the marker parameters.
127+
"""
119128
g = self.scn.geoms[self.scn.ngeom]
120129
# default values.
121130
g.dataid = -1

0 commit comments

Comments
 (0)