how does the pybullet client-server work?

Official Python bindings with a focus on reinforcement learning and robotics.
Post Reply
bluefish_
Posts: 8
Joined: Sun Jan 23, 2022 11:24 am

how does the pybullet client-server work?

Post by bluefish_ »

Hi!

I'm trying to understand how the pybullet client works, especially where the physics server is for the client to send requests and get results of the simulation. I was looking at the pybullet package source files and couldn't really figure out where the physics lives (only a wrapper for pybullet client in pybullet_utils).
Is it that somehow my computer runs a local server that does the physics? If I modify the bullet C++ source and build the pybullet from scratch, and then use that version of pybullet instead of the one installed via pip, is that going to be using the modified bullet source? If anyone knows where this code lives or how this works, I'd appreciate any explanations.

Sorry if this question has an obvious answer and thanks for any help in advance!
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: how does the pybullet client-server work?

Post by Erwin Coumans »

If you import pybullet and connect using GUI or DIRECT, then the client and server are both in the current same process.

You can start a physics server, using connect (pybullet.GUI_SERVER etc)
see for example this runServer.py script.
https://github.com/bulletphysics/bullet ... nServer.py

then you can connect using pybullet.connect(pybullet.SHARED_MEMORY)

If you want to compile your own pybullet, uninstall the default pip version, and make sure python can find the module.
One way is running

Code: Select all

python setup.py --develop in the root of Bullet
then after each change, uninstall and reinstall.
A better way is creating a symbolic link from pybullet.pyd to the dll, but it is best to use google how to install and debug python extension modules.
bluefish_
Posts: 8
Joined: Sun Jan 23, 2022 11:24 am

Re: how does the pybullet client-server work?

Post by bluefish_ »

Erwin Coumans wrote: Tue Mar 15, 2022 3:00 am If you import pybullet and connect using GUI or DIRECT, then the client and server are both in the current same process.

You can start a physics server, using connect (pybullet.GUI_SERVER etc)
see for example this runServer.py script.
https://github.com/bulletphysics/bullet ... nServer.py

then you can connect using pybullet.connect(pybullet.SHARED_MEMORY)

If you want to compile your own pybullet, uninstall the default pip version, and make sure python can find the module.
One way is running

Code: Select all

python setup.py --develop in the root of Bullet
then after each change, uninstall and reinstall.
A better way is creating a symbolic link from pybullet.pyd to the dll, but it is best to use google how to install and debug python extension modules.
Thank you so much! That makes sense. Yes I used the setup.py and it worked, sorry for some reason I was thinking the library should be compiled with the shell script in the repo.
Post Reply