Camera Rendering disrupts MjViewer #2474
-
IntroHi! I am a graduate student , I use MuJoCo for my research on Imitation Learning. My setupMuJoCo verison : 3.2.7 My questionI am trying to collect demonstration data using MuJoCo setup. I am trying to operate the robot while using the MjViewer and saving images from cameras in the scene. However when I render the image from the camera, the viewer freezes. There were similar issue reported, but it was unclear what the solution was. Pseudo-Code of the problem I am having : Minimal model and/or code that explain my questionCode: import mujoco.viewer
from dm_control import mjcf
# Create physics
physics = mjcf.Physics.from_mjcf_model(mjcf.RootElement().mjcf_model)
# Try to use both rendering methods in the same process
def step():
physics.step()
# This uses offscreen rendering
camera_image = physics.render(height=480, width=640)
# Then trying to use the viewer - this often fails
viewer.sync()
return camera_image
# Create viewer
viewer = mujoco.viewer.launch_passive(physics.model.ptr, physics.data.ptr)
# Run simulation
for _ in range(100):
img = step() # The viewer often shows blank or doesn't update Confirmations
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Please don't use dm_control. |
Beta Was this translation helpful? Give feedback.
Please don't use dm_control.