Skip to content

Commit

Permalink
Add max_visual_geom parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
amacati committed Feb 6, 2025
1 parent 1236f12 commit 5bfb0e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crazyflow/sim/sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def __init__(
self.n_worlds = n_worlds
self.n_drones = n_drones
self.freq = freq
self.max_visual_geom = 1000

# Initialize MuJoCo world and data
self._xml_path = xml_path or self.default_path
Expand Down Expand Up @@ -302,7 +303,7 @@ def thrust_control(self, cmd: Array):
def render(self):
if self.viewer is None:
patch_viewer()
self.viewer = MujocoRenderer(self.mj_model, self.mj_data, max_geom=1000)
self.viewer = MujocoRenderer(self.mj_model, self.mj_data, max_geom=self.max_visual_geom)
self.mj_data.qpos[:] = self.data.mjx_data.qpos[0, :]
self.mj_data.mocap_pos[:] = self.data.mjx_data.mocap_pos[0, :]
self.mj_data.mocap_quat[:] = self.data.mjx_data.mocap_quat[0, :]
Expand Down
3 changes: 3 additions & 0 deletions crazyflow/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ def patch_viewer():
the rendering pipeline between `mjv_updateScene`, which deletes all previous markers, and
`mjr_render`, so if we want to add markers to the scene, we need to do it here. The patch
ensures that markers are added correctly to the scene.
If you want to add more markers than the default limit, you can increase the `max_visual_geom`
parameter in the `Sim` class.
"""

def _add_marker_to_scene(self: BaseRender, marker: dict):
Expand Down

0 comments on commit 5bfb0e0

Please sign in to comment.