Change connection mode from DIRECT to GUI (launch GUI after connecting via DIRECT)

Official Python bindings with a focus on reinforcement learning and robotics.
Post Reply
imperialn00b
Posts: 1
Joined: Mon Feb 01, 2021 6:54 pm

Change connection mode from DIRECT to GUI (launch GUI after connecting via DIRECT)

Post by imperialn00b »

Hi,

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
Thanks!
Post Reply