dm_control icon indicating copy to clipboard operation
dm_control copied to clipboard

Getting started with interactive viewer

Open omershalev opened this issue 3 years ago • 1 comments

I'm new to mujoco and I wish to run my robot model in an interactive viewer. In various posts I encountered, it is recommended to use mujoco's simulate utility, however, to my understanding, simulate will not allow me full programmable control of my robots (e.g., applying external forces).

I guess I should use dm_control.viewer.launch(env), but this requires building a composer.Environment object as well as defining a Task, which seem pretty complex. Is there sample code showing how to generate a simple Environment object? Alternatively, is there an easier way to get started with interactive viewer?

omershalev avatar Nov 05 '22 21:11 omershalev

Hacking the simulate code should be very easy. You can write a callback that sets mjData.ctrl and set it at the beginning of the simulation, as explained here.

If you want to use Python, for now you indeed have to use the dm_control viewer. We are aware of the many drawbacks of this viewer and are working on a simulate-based native viewer based on @aftersomemath's PR. We are hoping to ship this feature within the next 1-2 weeks. You'll get a notification on this thread when it happens.

I recommend that you hack at the simulate code to start with, it easier than you think.

yuvaltassa avatar Nov 06 '22 13:11 yuvaltassa