-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
I would like to have a simulation (which is shown in a window) of which images are taken at regular intervals.
So i added a offscreen viewer to the example code like this
import mujoco
import mujoco_viewer
model = mujoco.MjModel.from_xml_path('~/mujoco/mujoco-2.3.5/model/humanoid/humanoid.xml')
data = mujoco.MjData(model)
# create the viewer objects
viewer = mujoco_viewer.MujocoViewer(model, data)
viewer1 = mujoco_viewer.MujocoViewer(model, data, 'offscreen')
imgs = []
for i in range(10000):
if viewer.is_alive:
mujoco.mj_step(model, data)
viewer.render()
if (i % 100) == 0:
print("Doing so,for %d"%i)
img = viewer1.read_pixels(camid=0)
imgs.append(img)
else:
break
viewer.close()
viewer1.close()
# do something with the images
When i do it this way, the normal window is not opened. When i exchange the order of the viewer creations, the viewer window opens but the window remains black.
Is it possible at all to have a window viewer and a offscreen viewer in the same simulation?
Metadata
Metadata
Assignees
Labels
No labels