bulletphysics / bullet3

Bullet Physics SDK: real-time collision detection and multi-physics simulation for VR, games, visual effects, robotics, machine learning etc.
http://bulletphysics.org
Other
12.58k stars 2.87k forks source link

Documentation for softbody objects in PyBullet #1175

Closed cpaxton closed 3 years ago

cpaxton commented 7 years ago

No documentation or existing tools on creating softbody objects from pybullet. It looks like they might need to be created via C++. More documentation would be helpful.

erwincoumans commented 7 years ago

Softbody hasn't been a priority, there was just a small test (soft body bunny) for grasping research. In the C-API, there are some b3LoadBunny* commands we could trivially hook up to pybullet. For this to be useful, you likely want to allow loading soft bodies from some standard file format (tetgen tegrahedral meshes or so).

In the end, we ended up just using rigid bodies with some compliance parameters (stiffness/damping). Those parameters are now exposed in pybullet, both in URDF and programmatically.

Just let me know what plans you had for softbody in pybullet.

cpaxton commented 7 years ago

I was interested in creating soft primitives (specifically the spheres or toruses in the example browser), but at different scales. Sounds like this would be relatively easy to expose in pybullet?

airballking commented 7 years ago

I would also be interested in using soft bodies from pybullet. Has there been any progress on this issue?

Specifically, I am looking for ways to simulate something like pancakes that can fold together or partially hang down a corner. The initial shape would come from some mesh file. It seems like the C++ API would allow doing this. Is this correct?

I would also be willing to invest some time in preparing a pull request. @erwincoumans would you be interested in such a feature request, and would you give some guidance in wrapping the existing C++ features?

erwincoumans commented 7 years ago

There is some super experimental softbody support in the Bullet C-API, which is underlying pybullet. See for example b3LoadBunnyCommandInit in PhysicsClientC_API.h. THere is basic btSoftBody versus btMultiBody.

It would be easy to hook it up to pybullet, I'll see if I find time to add a binding, but it would be nice to generalize beyond bunnies first :-)

Mind you, the pybullet.c Python binding code is huge and the related wrapper classes too (PhysicsServerCommandProcessor.cpp) and are not pretty (read messy) to work with. Still, you could give it a try, experiment a bit further with it.

ugocupcic commented 7 years ago

@erwincoumans I'm pretty interested in spawning softbodies from pybullet directly for simulating grasping as well.

In one of your comments above, you state: "we ended up just using rigid bodies with some compliance parameters (stiffness/damping)". Was it sufficient to get "realistic" grasps?

Cheers,

erwincoumans commented 7 years ago

We got reasonably well transfer of grasps from a model trained in sim, mixed with some episodes trained on real hardware. There is not much deformation happening in our grippers, and non-slip and lateral+torsional friction with some compliance worked well. We will get to softbody and fem, but need to add the same quality contact and friction under larger deformation.

githubkusi commented 5 years ago

I would be interested in modeling a rope in PyBullet (as seen in examples/SoftDemo/SoftDemo.cpp)

DarioUrbina commented 4 years ago

I am also interested in the Rope example, does it exist for pyBullet?

I am currently simulating many bodies connected in series of revolute joints, this seems to generate a rope-like behavior, But perturbing such a "rope" with fast force variations generated a chaotic behavior of the simulation. I guess this is because the time steps don't allow bullet to solve all the constraints involved.

I have also tried using the createContraint function to create connections of different urdf files through python code. These constraints, even though they are declared as "fixed", appear to change.

Any suggestions?