I run my PyBullet client in DIRECT mode for faster simulations, but I want to launch the existing physics client in a GUI when a particular event is triggered. Is there a way to do this? I have tried using the SHARED_MEMORY connection mode after having launched a client in DIRECT mode but I get a "Not connected to physics server" error.
To make things concrete, I want to do something like this:
Code: Select all
import pybullet as p
from pybullet_utils import bullet_client as bc
import random
sim = bc.BulletClient(connection_mode=p.DIRECT)
if (random.random() > 0.5):
# launch the `sim' client in a GUI here