Adding second camera breaks the process pool #371
Replies: 2 comments
-
So we currently do not have or support cameras, although they are or the wish list. For now we will not do anything with this but thank you for the report and we will keep it in mind when we decide to work on camera sensors. |
Beta Was this translation helpful? Give feedback.
-
One workaround you could try for experimentation purposes only is using the built-in recording functionality. You could change the viewpoint according to your theoretical camera location, however, for this, you would need to extend the used package by yourself. For more details please check the mujoco_viewer package: https://github.com/rohanpsingh/mujoco-python-viewer. |
Beta Was this translation helpful? Give feedback.
-
Dear Developers,
I am reporting a runtime issue encountered in the multiprocessing execution of the simulation batch process. The problem occurs during the initialization of a new camera using the OpenGLVision class within the multiprocessing environment managed by _local_runner.py.
My code can be found here: https://github.com/michelexyz/revolve2/tree/michele
Issue Details:
The exception is thrown after the instantiation of OpenGLVision, specifically as this line is executed inside the OpenGLVision class:
self.context = mujoco.MjrContext(model, mujoco.mjtFontScale.mjFONTSCALE_150.value)
This exception is not caught in the _run_environment method (where the OpenGLVision object is created at line 127) but is instead raised when future.result() is called within the run_batch function.
The program halts at the creation of the MuJoCo context when run in a multiprocessing setup, indicating a potential issue with how the context is handled in concurrent environments.
Current Behavior:
When running simulations in parallel using ProcessPoolExecutor, the creation of OpenGLVision objects seems to be conflicting with the multiprocessing model, leading to an unhandled exception that causes the worker process to crash. This crash is silent within the process itself and is only reported back as a Future exception in the main process.
Expected Behavior:
The OpenGLVision class should initialize without throwing an exception, or if an exception is thrown, it should be caught and logged within the _run_environment method for each worker process.
The purpose is to add a new camera to be used by the robot, but first we are just trying to get it to work and simply saving the it's frames as .pngs.
Os and python version
I'm on macOs using Python 3.10.11
My project colleague Satchit is experiencing the same problem on WSL
My code can be found here: https://github.com/michelexyz/revolve2/tree/michele
Beta Was this translation helpful? Give feedback.
All reactions