Hi,
i am trying to us bullet as a simulation tool for Reinforcement learning on manipulation of simple soft bodies. I adapted a grasp example to try picking up a piece of cloth, but it seems like the gripper just goes through the cloth, even tough the collision is detected. Any ideas on what I could check/fix to be able to simulate the grasping well?
It also seems like there is no friction whatsoever. I tried setting the dynamic friction coefficient, but it did not help. Searching through this forum yielded only https://pybullet.org/Bullet/phpBB3/viewtopic.php?t=8857, which seems to claim that friction does not quite work between soft bodies and rigid bodies.
I was hoping someone would know if this is implemented? Any ideas what I might be doing wrong or what shoud I try?
Gif of the problem: http://www.giphy.com/gifs/l0HU5PXvFOziJ27ni
Code creating the cloth: https://pastebin.com/3TLTP7cQ
Thanks a lot!
Softbody and rigidbody collision
-
- Posts: 849
- Joined: Tue Sep 30, 2014 6:03 pm
- Location: San Francisco
Re: Softbody and rigidbody collision
When I watch the GIF I see the soft body tunnel through the gripper on the left side. It snags for a bit along its top edge but as the gripper is lifted even that bit tunnels through until the whole soft body is outside. Some ideas on how to solve your problem:
(1) Gripping objects with friction works best when you use very short substeps. You should be using substeps not larger than 1/240 sec. What substep period are you using?
(2) If (1) doesn't help: the soft body would be less likely to tunnel when the shapes used for the gripper shapes are wider.
(1) Gripping objects with friction works best when you use very short substeps. You should be using substeps not larger than 1/240 sec. What substep period are you using?
(2) If (1) doesn't help: the soft body would be less likely to tunnel when the shapes used for the gripper shapes are wider.
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Softbody and rigidbody collision
drleviathan is right.
See https://github.com/bulletphysics/bullet3/pull/1500
As this effort proceeds, this should improve.
- a smaller timestep can improve things
- increase the soft body collision margin
- use the double-precision build
- make the softbody stiff enough
- by default we only collide with the vertices of a softbody, so you need to make sure there are no big gaps between the vertices
- enable collision 'clusters' that enables collision detection with groups of vertices instead, but it has its own issues but it may work for you.
See https://github.com/bulletphysics/bullet3/pull/1500
As this effort proceeds, this should improve.
-
- Posts: 7
- Joined: Sat Jan 06, 2018 4:44 pm
Re: Softbody and rigidbody collision
Hi drleviathan and Erwin,
thanks for awesome responses. My timestep is already fairly small (1/240.). I tried halving it but it did not help. Increasing the margin makes the tunnelling even more likely because the force pushing the cloth from inside the gripper is stronger (at least in my case).
I have decided to stop playing with cloth simulation (for now) and go back to the bunny, as it seems it might be less prone to tunnelling. I tried enabling cluster collisions and the tunnelling is mostly gone! Yay! However, the bunny still slips out - it is impossible to grasp it (Please see attached gif again).
Vertical slip: http://www.giphy.com/gifs/3ohc12qjDN3t3YubDO
Horizontal slip: http://www.giphy.com/gifs/3oFzmqsJC1YJfikxvq
From my experiments, it seems like friction is sort of broken with clusters. Can I be missing some flag I need to enable?
The code that generates the bunny is bellow. Moreover, I am setting lateral and rolling friction to 0.99 on all meshes in the gripper.
Do you have any ideas how I could solve this? Or maybe any changes to the library that could help (I am of course happy to contribute them back after testing it)?
Thank you very much!
thanks for awesome responses. My timestep is already fairly small (1/240.). I tried halving it but it did not help. Increasing the margin makes the tunnelling even more likely because the force pushing the cloth from inside the gripper is stronger (at least in my case).
I have decided to stop playing with cloth simulation (for now) and go back to the bunny, as it seems it might be less prone to tunnelling. I tried enabling cluster collisions and the tunnelling is mostly gone! Yay! However, the bunny still slips out - it is impossible to grasp it (Please see attached gif again).
Vertical slip: http://www.giphy.com/gifs/3ohc12qjDN3t3YubDO
Horizontal slip: http://www.giphy.com/gifs/3oFzmqsJC1YJfikxvq
From my experiments, it seems like friction is sort of broken with clusters. Can I be missing some flag I need to enable?
The code that generates the bunny is bellow. Moreover, I am setting lateral and rolling friction to 0.99 on all meshes in the gripper.
Code: Select all
btSoftBody* psb=btSoftBodyHelpers::CreateFromTriMesh(m_data->m_softBodyWorldInfo,&vertices[0],&indices[0],numTris);
btSoftBody::Material* pm=psb->appendMaterial();
pm->m_kLST = 0.5;
pm->m_flags -= btSoftBody::fMaterial::DebugDraw;
psb->generateBendingConstraints(2,pm);
psb->m_cfg.piterations = 20;
psb->m_cfg.kDF = 0.5;
psb->randomizeConstraints();
psb->m_cfg.collisions = btSoftBody::fCollision::CL_SS+ btSoftBody::fCollision::CL_RS;
psb->rotate(btQuaternion(0.70711,0,0,0.70711));
psb->translate(btVector3(-0.05,0,1.0));
psb->scale(btVector3(0.05,0.05,0.05));
psb->setTotalMass(0.1,true);
psb->getCollisionShape()->setMargin(0.01);
psb->generateClusters(1);
psb->m_cfg.kDF = 0.99;
Thank you very much!
-
- Posts: 7
- Joined: Sat Jan 06, 2018 4:44 pm
Re: Softbody and rigidbody collision
Quick update:
I have run the Friction softBody demo with 20 bunnies initialized with cluster collisions and friction work as expected. Sorry for a misleading suggestion. Any other ideas what might the problem with grasping?
I have run the Friction softBody demo with 20 bunnies initialized with cluster collisions and friction work as expected. Sorry for a misleading suggestion. Any other ideas what might the problem with grasping?