[ODE] Damping without adding forces
Anton Savin
anton at targem.ru
Tue Oct 26 10:37:07 MST 2004
Hello Bob,
>> The positive side of my damping is that it never produces jittering.
BD> Possibly - but the negative (depending on how you decide to
BD> enable/scale this damping at each frame(?)) is that you're model
BD> could just end up moving uniformly gloopily
In my simulation I set the value of damping to 0.1
As you can see, if the body moves freely, then by my damping its
velocity in one second will be scaled by about exp( -damping )
(exactly when timestep tends to 0). Of course, there can arise
some pathologic cases when the velocity will remain constant, but
in terms of damping it's better than if the body will accelerate.
Also with coefficients close to 0 the damping is almost invisible,
and I just hope that it will increase stability.
>> 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?
BD> Not intrinsically. Stability comes from many factors - a
BD> little damping can help smooth things out a bit but can bite you
BD> in the heel when you come to fold in other dynamics effects - for
BD> a simple example consider what happens to a particle falling under
BD> gravity - with this damping scheme it now no longer obeys the
BD> usual quadratic formula, anything in your codebase that expects
BD> that will now not work. That may not be an issue right now but
BD> it's the sort of thing that can surface when you least need it.
With damping that uses forces there is no quadratic formula too :)
And my damping in respect to physics is equivalent to applying some force
that is proportional to the value of the velocity and is directed
oppositely to it. In respect to physics, but of course not in respect
to ODE ;)
BD> I would say use your approach but avoid embedding it too
BD> deeply and try to be clear on what it is you're trying to model,
BD> if this is not a decent model of the thing you want, it could be a
BD> reasonable placeholder but it should be quickish to swap it out
BD> for any new-improved alternative.
I've written API that allows to set damping values for each body
separately, and default values for world, it's very similar to
auto-disabling API:
void dWorldSetDampingFlag( dWorldID, bool do_damping );
void dWorldSetDampingParameters( dWorldID, dReal linearDamping, dReal angularDamping );
void dBodySetDampingFlag( dBodyID, bool do_damping );
void dBodySetDampingParameters( dBodyID, dReal linearDamping, dReal angularDamping );
void dBodySetDampingDefaults( dBodyID );
BD> Now mod any silly mistakes on my part and funny numerical
BD> shinanigans, the above should be equivalent. The advantage of the
BD> second is that you know exactly what the physical damage is which
BD> is could be useful for modelling. For eg. if this were a sliding
BD> friction model you could say clip the impulse magnitude so it's
BD> smaller than the corresponding reaction and get something within a
BD> million miles of Coulomb sliding friction - etc.., etc.., you get
BD> the general idea.
Thank you for the advice, I'll possibly use momenta when more control
will be necessary.
Cheers,
Anton Savin
More information about the ODE
mailing list