update bullet_client.py to accept options

p.connect(p.GUI, options="--background_color_red=1 --background_color_blue=1 --background_color_green=1")

If you use bullet_client.py, you can use:
p = bc.BulletClient(connection_mode=pybullet.GUI,options="--background_color_red=1 --background_color_blue=1 --background_color_green=1")
--mouse_move_multiplier=0.4
--mouse_wheel_multiplier=0.01
--mp4=moviename.mp4
This commit is contained in:
Erwin Coumans
2021-02-25 16:32:39 -08:00
parent de8f04f819
commit 97add36b9f

View File

@@ -9,7 +9,7 @@ import pybullet
class BulletClient(object):
"""A wrapper for pybullet to manage different clients."""
def __init__(self, connection_mode=None, hostName=None):
def __init__(self, connection_mode=None, hostName=None, options=''):
"""Creates a Bullet client and connects to a simulation.
Args:
@@ -22,15 +22,15 @@ class BulletClient(object):
"""
self._shapes = {}
if connection_mode is None:
self._client = pybullet.connect(pybullet.SHARED_MEMORY)
self._client = pybullet.connect(pybullet.SHARED_MEMORY, options=options)
if self._client >= 0:
return
else:
connection_mode = pybullet.DIRECT
if hostName is None:
self._client = pybullet.connect(connection_mode)
self._client = pybullet.connect(connection_mode, options=options)
else:
self._client = pybullet.connect(connection_mode, hostName=hostName)
self._client = pybullet.connect(connection_mode, hostName=hostName, options=options)
def __del__(self):
"""Clean up connection if not already done."""