benelot / pybullet-gym

Open-source implementations of OpenAI Gym MuJoCo environments for use with the OpenAI Gym Reinforcement Learning Research Platform.
https://pybullet.org/
Other
814 stars 124 forks source link

Stopping render - relation between the simulation and rendering #64

Open misterguick opened 3 years ago

misterguick commented 3 years ago

Hello !

I just discovered your package. I would like to use it as a drop in replacement in my implementation but I am facing some issues regarding rendering.

My first question is naive but https://github.com/bulletphysics/bullet3/issues/2306 suggests that rendering and the actual physical state simulation are related. Let's say I want to use InvertedPendulumPyBulletEnv-v0. Will rendering change the way the physics is simulated ?

My second question follows the first one. I would like to render only at evaluation time. Is that a good idea ? It seems rendering is to be opened once for all and is not intended to be opened and closed many times.

Thank you in advance !

benelot commented 3 years ago

Hi!

No, simulation and physics are not related in that sense. The thing is that if you require a camera image as your input, then the renderer differs depending on whether you have a GUI open or closed. For rendering, the renderer requires 3D models, about which the physics engine does not know anything. So for the camera image, it has to quickly create these 3D models, take the image and then drop this again, while in the GUI case it just can snap the image from the GUI buffer. If you are not using the camera image as input feature, you can easily render only at evaluation time. Does that answer your question?