Moving from Bullet 2 to Pybullet

Official Python bindings with a focus on reinforcement learning and robotics.
Post Reply
maiklof
Posts: 15
Joined: Wed Nov 20, 2013 10:01 am

Moving from Bullet 2 to Pybullet

Post by maiklof » Thu Oct 04, 2018 10:18 pm

Hi everyone!
First of all, I want to thank you for the great job you are doing with the Bullet Physics library!
I have been using Bullet 2 for many years now, but mostly in python, thanks to a wrapper I found on the internet and I have been maintaining and developing further. Now I am considering moving to PyBullet but I have some questions. I think it is important to say that I just need a physics engine for my project, without the GUI, VR, AI and the new advanced extra features, so I am interested in using the DIRECT mode. The visualization will be done using a 3D engine. I will use the GUI mode just for debugging. I will need to create different kind of single and multi-body objects, using meshes, constraints and create robots and mechanisms. So, as far as I can see in the documentation, there is plenty of useful methods to make all this very easily... But I miss some stuff from Bullet 2, at least looking to the documentation:

1. Have bodyes MotionStates in pyBullet? Or is there any way to get notifications of the objects that are moving? I can have many dynamic objects in a system and need to know which are moving to get the transform and render them.
2. I see that collision filter masks are implemented for shapes, but what happens with ray tests in pybullet? (Batch Tests are a great feature btw.!)
3. I have been using collision callbacks to modify collision points to simulate Conveyor belt-like behavior in some shapes, among other things. I use the CF_CUSTOM_MATERIAL_CALLBACK and the user-data pointer of the shapes that I am interested to provide some "material" information, and then change the behavior of the surface in the callback function. I think that being able to handle material information of the surfaces to modify the manifolds (like friction, damping, contact motion, etc...) brings many possibilities. I do not know if could implement this as a plugin or there is another way to do this kind of things in pybullet...

I think I will need to check pybullet in more detail to get a better idea of the limitations compared to the C++ library. But because I am interested in using it in python I would be happy to help if there is anything I can contribute and bring these features if they can be implemented.

Thanks in advance!

User avatar
Erwin Coumans
Site Admin
Posts: 4126
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Moving from Bullet 2 to Pybullet

Post by Erwin Coumans » Fri Oct 05, 2018 12:56 am

Yes, the GUI mode is primarily as debug visualizer.

PyBullet has a plugin system (loadPlugin) to customize things.

>> 1. Have bodies MotionStates in pyBullet?

No motion states, but you can write a plugin that gets all notifications of changes, we have some internal plugin for this to notify an external renderer through GRPC. You/we could expose changes to Python, but Python may be not the best choice (a bit slow). I'll see if we can write a default plugin that allows Python to query for the changes since last Python call. The plugin needs to implement a "processNotifications" function, see also the b3PluginManager.cpp for details.


>> ray tests in pybullet?
This is also supposed to happen in a plugin. At the moment, the collisionFilterPlugin only implement a callback if a collision should happen. I need to check if rayTests apply the same filter, we can improve it if not.

>>3. I have been using collision callbacks

This is also a good candidate to write in a C plugin.

Just give PyBullet a try, and dig in the code.

maiklof
Posts: 15
Joined: Wed Nov 20, 2013 10:01 am

Re: Moving from Bullet 2 to Pybullet

Post by maiklof » Sat Oct 06, 2018 7:23 pm

Thanks for your answer Erwin!
I will definitely give pybullet a try and see if I can learn how to program a plugin. Do you have any documentation or should I check the source code and figure it out?
As I wrote, I will be happy to contribute or help if possible. I leave the link to my old project (I am working on a new platform) so you know which kind of simulation I do: www.simumatik.com.
Thanks, you are great!
Mikel

Post Reply