Skip to content

Commit

Permalink
Add width and height check for MujocoRenderer (#1230)
Browse files Browse the repository at this point in the history
  • Loading branch information
Beanpow authored Oct 25, 2024
1 parent dc36e96 commit 137be19
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gymnasium/envs/mujoco/mujoco_rendering.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,10 @@ def render(
Returns:
If render_mode is "rgb_array" or "depth_array" it returns a numpy array in the specified format. "human" render mode does not return anything.
"""
if render_mode != "human":
assert (
self.width is not None and self.height is not None
), f"The width: {self.width} and height: {self.height} cannot be `None` when the render_mode is not `human`."

viewer = self._get_viewer(render_mode=render_mode)

Expand Down

0 comments on commit 137be19

Please sign in to comment.