From 97add36b9fda8d76396ff84a9cf1567cfb508b30 Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Thu, 25 Feb 2021 16:32:39 -0800 Subject: [PATCH] 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 --- examples/pybullet/gym/pybullet_utils/bullet_client.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/pybullet/gym/pybullet_utils/bullet_client.py b/examples/pybullet/gym/pybullet_utils/bullet_client.py index f4995d3b5..6543313d0 100644 --- a/examples/pybullet/gym/pybullet_utils/bullet_client.py +++ b/examples/pybullet/gym/pybullet_utils/bullet_client.py @@ -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."""