def consume(bullet_connect_mode, connection): # runs in sep. process client = bc.BulletClient(bullet_connect_mode) while True: method, args, kwargs = connection.recv() result = getattr(client, method)(*args, **kwargs) connection.send(result)
def bullet_client(): client = bc.BulletClient(pybullet.DIRECT) client.setGravity(0, 0, -9.8) path = Path(__file__).parent / "../smarts/core/models/plane.urdf" with pkg_resources.path(models, "plane.urdf") as path: plane_path = str(path.absolute()) plane_body_id = client.loadURDF(plane_path, useFixedBase=True) yield client client.disconnect()
def bullet_client(timestep_sec=time_step): client = bc.BulletClient(pybullet.DIRECT) client.resetSimulation() client.setGravity(0, 0, -9.8) client.setPhysicsEngineParameter( fixedTimeStep=timestep_sec, numSubSteps=int(timestep_sec / (1 / 240)), ) path = Path(__file__).parent / "../models/plane.urdf" path = str(path.absolute()) plane_body_id = client.loadURDF(path, useFixedBase=True) yield client client.disconnect()
def consume(bullet_connect_mode, connection: Connection): """Builds a child pybullet process. Args: bullet_connect_mode: The type of bullet process. connection: The child end of a pipe. """ # runs in sep. process client = bc.BulletClient(bullet_connect_mode) while True: method, args, kwargs = connection.recv() result = getattr(client, method)(*args, **kwargs) connection.send(result)
def bullet_client(): client = bc.BulletClient(pybullet.DIRECT) client.setGravity(0, 0, -9.8) path = Path(__file__).parent / "../smarts/core/models/plane.urdf" with pkg_resources.path(models, "plane.urdf") as path: plane_path = str(path.absolute()) # create the ground plane to be big enough that the vehicles can potentially contact the ground too client.loadURDF( plane_path, useFixedBase=True, basePosition=(0, 0, 0), globalScaling=1000.0 / 1e6, ) yield client client.disconnect()
sliders["rolling_friction"]), contactStiffness=client.readUserDebugParameter( sliders["contact_stiffness"]), contactDamping=client.readUserDebugParameter( sliders["contact_damping"]), # anisotropicFriction=client.readUserDebugParameter( # sliders["anisotropic_friction"] # ), ) if __name__ == "__main__": # https://turtlemonvh.github.io/python-multiprocessing-and-corefoundation-libraries.html # mp.set_start_method('spawn', force=True) client = bc.BulletClient(pybullet.GUI) # client = BulletClient(pybullet.GUI) # client.configureDebugVisualizer(pybullet.COV_ENABLE_GUI, 0) client.configureDebugVisualizer(pybullet.COV_ENABLE_WIREFRAME, 1) sliders = dict( lateral_friction=client.addUserDebugParameter("Lateral Friction", 0, 10, 3), spinning_friction=client.addUserDebugParameter("Spinning Friction", 0, 1, 0), rolling_friction=client.addUserDebugParameter("Rolling Friction", 0, 1, 0), contact_stiffness=client.addUserDebugParameter("Contact Stiffness", 0, 1e6, 100000), contact_damping=client.addUserDebugParameter("Contact Damping", 0, 1e6, 35000),
def bullet_client(): client = bc.BulletClient(pybullet.DIRECT) yield client client.disconnect()