dm_control icon indicating copy to clipboard operation
dm_control copied to clipboard

Single step the viewer render?

Open rubendsa opened this issue 3 years ago • 1 comments

Is there a recommend way to single step the viewer renderer?

In the example code snippet, I would like to grab input (ex: keyboard presses for direction) and update viewer frames. Currently, viewer.launch(env) blocks.

if __name__ == "__main__":

    physics = mujoco.Physics.from_xml_path(MODEL_PATH_XML)
    task = Xarm7()
    env = control.Environment(
        physics, task, time_limit=_TIME_LIMIT, control_timestep=_CONTROL_TIMESTEP
    )

    action_spec = env.action_spec()
    time_step = env.reset()
    viewer.launch(env)

An alternative is to encode the teleoperation input as a policy, however it's a bit unclear how that structure would look. Any example snippets would greatly appreciated!

rubendsa avatar Nov 17 '21 03:11 rubendsa

The dm_robotics repo has a solution to this: check out their mujoco_rendering.py module.

kevinzakka avatar Mar 09 '22 00:03 kevinzakka