[ODE] Re: Jitters

Matthew D. Hancher mdh at email.arc.nasa.gov
Mon Nov 8 18:16:21 MST 2004


This gets at something I've been meaning to comment on for a while now.  
If you're doing damping by manually applying forces and torques, you really 
want them to be proportional to the body's *momentum*, not velocity.  Not 
only will this improving damping performance and stability over a wide 
range of object masses, but it will also prevent peculiar rotational motion 
that you might experience if you have bodies with peculiar inertia tensors.

Try something like:

dReal *lvel = dBodyGetLinearVel( body );
dReal *avel = dBodyGetAngularVel( body );
dMass mass;
dBodyGetMass( body, &mass );
dReal ldamping = -0.01 * mass.mass;
dBodyAddForce( body, ldamping*lvel[0], ldamping*lvel[1], ldamping*lvel[2] );
dVector3 amom;
dMULTIPLYOP0_331( amom, =, avel, mass.I );
dReal adamping = -0.01;
dBodyAddTorque( body, adamping*amom[0], adamping*amom[1], adamping*amom[2] );

(Appologies in advance for any typos; I use a highly customized version of 
ODE, so I couldn't just cut-and-paste my actual code.  Something along 
these lines is probably what you want, though.)

> What is the mass?  If its very small then even 0.01x the velocity can be 
> too great a force (I've seen this with very small objects).  Try a lower 
> value for both linear and angular, and see if it fixes it, (e.g. -0.001).

Matt Hancher
NASA Ames Research Center
mdh at email.arc.nasa.gov


More information about the ODE mailing list