How does bullet calculate static and dynamic frictions?

shchhan
Posts: 8
Joined: Sat Nov 09, 2013 10:16 pm

How does bullet calculate static and dynamic frictions?

Post by shchhan »

I created a simple robot hand and used the hand to grasp a box. The grasping was far more stable than I expected. I'm very interested in learning more about how the normal force, static and dynamic frictions are calculated given a contact. If it's hard to explain in several words, can anyone point me to the paper or any document the implementation is based on? Thanks.
Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: How does bullet calculate static and dynamic frictions?

Post by Basroil »

You should look for Erin Catto's paper in the theory section of the forum for exact math, but in general, Bullet applies neither static nor dynamic friction useful for grasping (EDIT: Bullet does indeed apply normal force based friction not the mass-gravity approximation) . The maximum friction is calculated as a function of the weight of the object, and a friction multiplier, which works fine when stacking on flat surfaces but not for robot dynamics.

One trick you could do, though it's more of a hack, is to use a custom contact method to try and calculate it yourself (assuming you know how much force the robot applies)
Last edited by Basroil on Sun Nov 24, 2013 6:26 am, edited 1 time in total.
shchhan
Posts: 8
Joined: Sat Nov 09, 2013 10:16 pm

Re: How does bullet calculate static and dynamic frictions?

Post by shchhan »

I'm not very familiar with these concepts yet and got a little confused by: Bullet applies neither static nor dynamic friction useful for grasping. Do you mean that bullet does not particularly handle the active forces or torques applied by the robot hand? I think it just handles these contact problems by using their constraint solver. Is that what you mean?
I found a slide by Erin Catto which has a brief introduction about the constraint solver. Thanks for the information.
Last edited by shchhan on Sun Nov 24, 2013 4:01 am, edited 1 time in total.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: How does bullet calculate static and dynamic frictions?

Post by Erwin Coumans »

Basroil wrote:Bullet applies neither static nor dynamic friction useful for grasping. The maximum friction is calculated as a function of the weight of the object, and a friction multiplier
This is not true, Bullet uses the normal force (not a weight hack), it is simplified Coulomb friction using a friction pyramid instead of a cone. There is only a single friction coefficient, used for both static and dynamic friction. When you use a small internal timestep and many iterations, or using the NNCG solver, Dantzig or Lemke, you get sufficient quality for robotics.

Thanks,
Erwin
shchhan
Posts: 8
Joined: Sat Nov 09, 2013 10:16 pm

Re: How does bullet calculate static and dynamic frictions?

Post by shchhan »

Thanks. I noticed Dantzig is a new constraint solver ported from ODE. I'll use that for the simulation and see how it works. It's good to know the solvers are good suitable for robot simulations.
Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: How does bullet calculate static and dynamic frictions?

Post by Basroil »

Erwin Coumans wrote:
Basroil wrote:Bullet applies neither static nor dynamic friction useful for grasping. The maximum friction is calculated as a function of the weight of the object, and a friction multiplier
This is not true, Bullet uses the normal force (not a weight hack), it is simplified Coulomb friction using a friction pyramid instead of a cone. There is only a single friction coefficient, used for both static and dynamic friction. When you use a small internal timestep and many iterations, or using the NNCG solver, Dantzig or Lemke, you get sufficient quality for robotics.

Thanks,
Erwin
Yes, just checked that and indeed it calculated maximum friction based on external applied force and velocity (used to calculate inertia based force i would guess). I had just assumed it was as written in the Catto paper, approximating friction with just gravity and mass. My mistake, I should have said "If bullet follows the paper it would apply an approximation".

As for sufficient quality for robotics, not sure you can do it in real-time with many iterations. I've tried grasping with a chain of motor joints (opposing contact points were sometimes 4-5 bodies away) and the friction was not even 10% of what it should have been even at 1/500 time step and 500 iterations (maximum my i5 chip could handle in release). Haven't updated that code for the new solvers, but if Dantzig works as well as it has on a few of my other tests it might actually have made half my hardware experiments (and half dozen burned out motors) pointless :wink: