You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm a research assistant and I'm trying to take pictures of my MuJoCo simulation using a simulated camera.
Currently, I have my main rendering loop running:
main render loop
defrun(self) ->None:
""" Method for running the MuJoCo viewer main loop. Returns: - None. """withmj.viewer.launch_passive(model=self._model, data=self._data, key_callback=self.keyboard_callback) asviewer:
# load initial stateload_mj_state(self._model, self._data, "home", self._lock)
mj.mj_step(self._model, self._data)
# Toggle site frame visualization.ifself._args.show_site_frames:
viewer.opt.frame=mj.mjtFrame.mjFRAME_SITEwhileviewer.is_running():
step_start=time.time()
# Step the simulation.mj.mj_step(self._model, self._data)
viewer.sync()
time_until_next_step=self.dt- (time.time() -step_start)
iftime_until_next_step>0:
time.sleep(time_until_next_step)
while I have my keyboard_callback function defined as
`keyboard_callback`
defkeyboard_callback(self, key) ->None:
""" Method for the keyboard callback. This method should not be called explicitly. Parameters: - key: Keyboard input. Returns: - None. """ifkey==glfw.KEY_COMMA:
print(self.cam.image)
When I call the cam.image attribute, the following function is run
The self._renderer is here a mj.Renderer object defined by self._renderer = mj.Renderer(self._model, self._height, self._width) where self._model is the model object loaded from the scene file.
After I call the image attribute, the GUI becomes unresponsive while the main rendering loop still seems to be running just fine. Ideally, I would want to control the GUI after i have rendered a picture from the camera.
All feedback and/or ideas for how I could progress/solve this problem of mine are very much appreciated!
The text was updated successfully, but these errors were encountered:
Hello there,
I'm a research assistant and I'm trying to take pictures of my MuJoCo simulation using a simulated camera.
Currently, I have my main rendering loop running:
main render loop
while I have my
keyboard_callback
function defined as`keyboard_callback`
When I call the
cam.image
attribute, the following function is runget image attribute
The
self._renderer
is here amj.Renderer
object defined byself._renderer = mj.Renderer(self._model, self._height, self._width)
whereself._model
is the model object loaded from the scene file.After I call the image attribute, the GUI becomes unresponsive while the main rendering loop still seems to be running just fine. Ideally, I would want to control the GUI after i have rendered a picture from the camera.
All feedback and/or ideas for how I could progress/solve this problem of mine are very much appreciated!
The text was updated successfully, but these errors were encountered: