[ODE] Damping without adding forces

Bob Dowland Bob.Dowland at blue52.co.uk
Mon Oct 25 15:14:58 MST 2004


>   The positive side of my damping is that it never produces jittering.

Possibly - but the negative (depending on how you decide to enable/scale this damping at each frame(?)) is that you're model could just end up moving uniformly gloopily - something that occasionally may *look* like friction because the viewer is trying hard to believe it but often will just make the motion look a bit sluggish - like it's under water.

>   The question is: If I apply forces, it affects solver, and it can increase
>   stability. But I don't touch solver here, so is stability increased
>   by my damping or not?

Not intrinsically. Stability comes from many factors - a little damping can help smooth things out a bit but can bite you in the heel when you come to fold in other dynamics effects - for a simple example consider what happens to a particle falling under gravity - with this damping scheme it now no longer obeys the usual quadratic formula, anything in your codebase that expects that will now not work. That may not be an issue right now but it's the sort of thing that can surface when you least need it.

I would say use your approach but avoid embedding it too deeply and try to be clear on what it is you're trying to model, if this is not a decent model of the thing you want, it could be a reasonable placeholder but it should be quickish to swap it out for any new-improved alternative.

:)

Bob.

BTW a first step might be to investigate applying this damping via an impulse

// your code
>           b->lvel[ j ] *= REAL( 1.0 ) - b->damping.linearDamping * h;

// equivalent in momentum and change in momentum (ie impulse)
>		impulse = b->LinearMomentum[j] * b->damping.linearDamping * h;
>		b->LinearMomentum[j] -= impulse;

-- erhh.. I'm assuming existence of member LinearMomentum, and that h is the "time-delta" otherwise YMMV ;) (I'm also assuming that when you monkey with lvel, there is a corresponding "update" for the body's momentum - at least there better be =:0 ).

Now mod any silly mistakes on my part and funny numerical shinanigans, the above should be equivalent. The advantage of the second is that you know exactly what the physical damage is which is could be useful for modelling. For eg. if this were a sliding friction model you could say clip the impulse magnitude so it's smaller than the corresponding reaction and get something within a million miles of Coulomb sliding friction - etc.., etc.., you get the general idea.



> -----Original Message-----
> From: Anton Savin [mailto:anton at targem.ru]
> Sent: 25 October 2004 09:08
> To: ode at q12.org
> Subject: [ODE] Damping without adding forces
> 
> 
> Hi, all
> 
> I've just realized damping in my version of ODE, just by modifying
> body's velicity in dxStepBody:
> 
>   // handle linear velocity
>   for (j=0; j<3; j++)
>   {
> 
>  // inserted code
>       if( b->flags & dxBodyDamping )
>           b->lvel[ j ] *= REAL( 1.0 ) - b->damping.linearDamping * h;
>  // end of inserted code
>           
>       b->pos[j] += h * b->lvel[j];
>   }
> 
>   The damping to angular velocity is applied similarly.
> 
> 
>   The positive side of my damping is that it never produces jittering.
> 
>   The question is: If I apply forces, it affects solver, and 
> it can increase
>   stability. But I don't touch solver here, so is stability increased
>   by my damping or not?
> 
> Thanks in advance,
> Anton Savin
> 
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
> 

> -----Original Message-----
> From: Anton Savin [mailto:anton at targem.ru]
> Sent: 25 October 2004 09:08
> To: ode at q12.org
> Subject: [ODE] Damping without adding forces
> 
> 
> Hi, all
> 
> I've just realized damping in my version of ODE, just by modifying
> body's velicity in dxStepBody:
> 
>   // handle linear velocity
>   for (j=0; j<3; j++)
>   {
> 
>  // inserted code
>       if( b->flags & dxBodyDamping )
>           b->lvel[ j ] *= REAL( 1.0 ) - b->damping.linearDamping * h;
>  // end of inserted code
>           
>       b->pos[j] += h * b->lvel[j];
>   }
> 
>   The damping to angular velocity is applied similarly.
> 
> 
>   The positive side of my damping is that it never produces jittering.
> 
>   The question is: If I apply forces, it affects solver, and 
> it can increase
>   stability. But I don't touch solver here, so is stability increased
>   by my damping or not?
> 
> Thanks in advance,
> Anton Savin
> 
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
> 



More information about the ODE mailing list