What do you guys do for friction?

Please don't post Bullet support questions here, use the above forums instead.
jam
Posts: 10
Joined: Wed Jun 14, 2006 11:41 pm

What do you guys do for friction?

Post by jam »

I've been going constantly forward and back between Baraff's 'Fast contact force computation' paper and Kawachi's 'Impulsive Friction' papers and have not yet found a clear description on how to incorporate the Coulomb friction model's constrains into my Dantzig-based LCP solver (or any LCP solver for that matter). My engine's using the LCP formulation for velocity level for impulse computation at simultaneuos colliding points.

Anyway, I was wondering how you guys are approximating friction for your engines or actually incorporating the exact Coulomb friction model.

Any suggestion or idea is welcome and I'm really desperate for implementing Coulomb friction :(.

-jam
Erin Catto
Posts: 316
Joined: Fri Jul 01, 2005 5:29 am
Location: Irvine

Post by Erin Catto »

If you don't need an exact solution, I recommend using sequential impulses. With sequential impulses it is simple to orient the friction direction with the sliding motion. If there is no sliding, it can fall back to an anisotropic friction model.

Bullet uses sequential impulses for friction and other constraints. Also see this tutorial: http://www.gphysics.com/files/GDC2006_ErinCatto.zip
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Post by Dirk Gregorius »

First you choose two perpendicular vectors (or more depending on how exact you want to approximate the Coloumb friction cone) in your contact plane. Basically something like this:

// Let n be the normal of the contact patch

v32 t1, t2;
MATHvec3Perp( t1, n );
MATHvec3Cross( t2, t1, n );

Then you define the two related velocity constraints;

dC1/dt = ( v1 + w1 x r1 - v2 - w2 x r2 ) * t1
dC2/dt = ( v1 + w1 x r1 - v2 - w2 x r2 ) * t2


Note that friction constraints are non-holonome since there exists no position constraint for them. Practically this means there is no stabilization term (Baumgarte).

The tricky part now is that the friction constraints are related to the corrsponding normals through the Coloumb friction law, that means for the block LCP you get the following conditions:

-mu * lambda_n < lambda_t1 < mu * lambda_n
-mu * lambda_n < lambda_t2 < mu * lambda_n

I don't know how this gets incorporated into your Danzig solver, but Iassume you must make sure to solve the corresponding normal force (impulse) before the related friction constraints. Then you can clamp your friction forces. AFAIK the ODE has an direct solver based on Danzig's algorithm so you might look how they do it there. I personally don't like the way how it is done in the ODE in quickstep using "findex", but you can quickly find easier solutions.

HTH,

-Dirk

PS: I suggest to look up the following papers for more information:

Thesis of Kenny Erleben:
http://www.diku.dk/~kenny/thesis.pdf

Papers of Erin Catto:
http://www.gphysics.com/gdc-2005/
http://www.gphysics.com/gdc-2006/