Skip to content

Commit

Permalink
rgb renderer fix: update model of renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
driesmarzougui committed Mar 8, 2024
1 parent 6fbb6e7 commit 051610d
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions moojoco/environment/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,7 @@ def _get_mj_models_and_datas_to_render(
def render(self, state: BaseEnvState) -> List[RenderFrame] | None:
camera_ids = self.environment_configuration.camera_ids or [-1]

try:
mj_models, mj_datas = self._get_mj_models_and_datas_to_render(state=state)
except ValueError:
# Waiting on https://github.com/google-deepmind/mujoco/issues/1379
return None
mj_models, mj_datas = self._get_mj_models_and_datas_to_render(state=state)

frames = []
for i, (model, data) in enumerate(zip(mj_models, mj_datas)):
Expand All @@ -301,6 +297,7 @@ def render(self, state: BaseEnvState) -> List[RenderFrame] | None:
return renderer.render(render_mode="human", camera_id=camera_ids[0])
else:
for camera_id in camera_ids:
renderer._model = model
renderer.update_scene(data=data, camera=camera_id)
frame = renderer.render()[:, :, ::-1]
frames.append(frame)
Expand Down

0 comments on commit 051610d

Please sign in to comment.