Skip to content

Commit 32dffb4

Browse files
committed
Add Wrapper.render: prevent accidental overriding of render.
1 parent e7c1677 commit 32dffb4

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

mujoco_playground/_src/wrapper.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@
1515
"""Wrappers for MuJoCo Playground environments."""
1616

1717
import functools
18-
from typing import Any, Callable, Optional, Tuple
18+
from typing import Any, Callable, List, Optional, Sequence, Tuple
1919

2020
from brax.envs.wrappers import training as brax_training
2121
import jax
2222
from jax import numpy as jp
2323
import mujoco
2424
from mujoco import mjx
25+
import numpy as np
2526

2627
from mujoco_playground._src import mjx_env
2728

@@ -67,6 +68,21 @@ def mjx_model(self) -> mjx.Model:
6768
def xml_path(self) -> str:
6869
return self.env.xml_path
6970

71+
def render(
72+
self,
73+
trajectory: List[mjx_env.State],
74+
height: int = 240,
75+
width: int = 320,
76+
camera: Optional[str] = None,
77+
scene_option: Optional[mujoco.MjvOption] = None,
78+
modify_scene_fns: Optional[
79+
Sequence[Callable[[mujoco.MjvScene], None]]
80+
] = None,
81+
) -> Sequence[np.ndarray]:
82+
return self.env.render(
83+
trajectory, height, width, camera, scene_option, modify_scene_fns
84+
)
85+
7086

7187
def wrap_for_brax_training(
7288
env: mjx_env.MjxEnv,

0 commit comments

Comments
 (0)