Connecting pybullet to a C++ Bullet Physics instance?

Official Python bindings with a focus on reinforcement learning and robotics.
Post Reply
alexclegg
Posts: 1
Joined: Thu Aug 22, 2019 5:40 pm

Connecting pybullet to a C++ Bullet Physics instance?

Post by alexclegg »

Hey there,

We are working on supporting physical interactions in Habitat-sim https://github.com/facebookresearch/habitat-sim. We have use cases which require physics engine integration at the C++ level, but would also like to enable interfacing with python as well. As pybullet has so many excellent features already, we would love to leverage it as much as possible rather than binding and wrapping things again. I've looked at some of the client/server resources which are available and was hoping to get your suggestions for which option would work best for us. Can we create a SHARED_MEMORY connection between our C++ bullet instances and a pybullet client? Is there another way you would suggest?

Thanks in advance for your thoughts!
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Connecting pybullet to a C++ Bullet Physics instance?

Post by Erwin Coumans »

Yes, you can create a PyBullet server and client and also connect to this from a C++ client using the C-API, which is pretty much identical to the PyBullet API (PyBullet uses this same C API).

The API header file is here:
https://github.com/bulletphysics/bullet ... entC_API.h

Note that you should not use the regular Bullet C++ API but only the Bullet C-API! This pretty much means you have to re-do the integration, but it would be worth it.

We are using this functionality (mixing C++ and PyBullet) in various projects within Google Brain.

I tried to encourage the project to use PyBullet and possibly its C-API here:
https://github.com/facebookresearch/hab ... r306585112

For many cases, the multibody (btNultiBody) functionality is better too, instead of btRigidBody+btTypeConstraint.
Post Reply