I want to simulate a two-fingered robot hand holding an object, to see whether the object slips out of the hand. I have created the collision shape for each finger and the object as a btGImpactMeshShape. In this example, the fingers and object are simply cuboids, but this will later be extended to convex meshes. Then, I have created three rigid bodies with the mass of the fingers to be zero so that they are static, and the mass of the object to be a positive number so that it is dynamic. The friction of each is then set to 0.5.
So now, I want to simulated what would happen when the fingers are brought together on the object and are resting on the object's surface. But I'm confused as to what to do in terms of the collision margins, the actual positions of the bodies, and any forces applied. Below are four options I have come up with. Which are suitable? Are there any other better ways?
1) The collision margin is set to zero, and the fingers are positioned so that the edge of each finger lines up exactly with the edge of the object.
2) The collision margin is set to a small value, and the fingers are positioned so that the edge of each finger (excluding the collision margin) lines up exactly with the edge of the object.
3) The collision margin is set to a small value, and the fingers are positioned so that the edge of each finger (including the collision margin) lines up exactly with the edge of the object.
4) Any of 1), 2) or 3), but also applying a force from the fingers onto the object.
Building a robot gripper simulation
-
- Posts: 849
- Joined: Tue Sep 30, 2014 6:03 pm
- Location: San Francisco
Re: Building a robot gripper simulation
My understanding is the collision margin is intended to be an optimization, to prevent shapes from interpenetrating during most collisions because the GJK algorithm, which computes the contact point between two convex shapes, gets expensive (it fails and then special logic must be applied instead) when the fundamental shapes actually overlap.
So, I think the answer is (3) collision margins all around and the objects should touch at the margins. Note that the some shape-shape collisions do or do not use the margins depending on the shapes involved. There is a youtube video showing how the margins behave using blender's Bullet plugin, you should watch that if you have not already.
You should keep in mind that while Bullet is a fast an accurate dynamics simulation library it is not necessarily accurate for friction interactions near the dynamic/static friction boundary. It will do friction, and you can make interactive simulations that rely on it, but the results are probably not an accurate representation of what would happen in the real world under "identical" circumstances. For more accurate simulations there are some other simulation libraries. I haven't used any of the others but I believe the "simbody" project is more accurate for friction interactions.
So, I think the answer is (3) collision margins all around and the objects should touch at the margins. Note that the some shape-shape collisions do or do not use the margins depending on the shapes involved. There is a youtube video showing how the margins behave using blender's Bullet plugin, you should watch that if you have not already.
You should keep in mind that while Bullet is a fast an accurate dynamics simulation library it is not necessarily accurate for friction interactions near the dynamic/static friction boundary. It will do friction, and you can make interactive simulations that rely on it, but the results are probably not an accurate representation of what would happen in the real world under "identical" circumstances. For more accurate simulations there are some other simulation libraries. I haven't used any of the others but I believe the "simbody" project is more accurate for friction interactions.