[ODE] Re: Possible solution to unstable rotating bodies problem

Matthew Hancher mdh at email.arc.nasa.gov
Wed Apr 13 00:35:04 MST 2005

Quoth Erin Catto:
> That's essentially how position projection works. Do a time step with 
> no
> external forces and use ERP to penalize position errors. Also set dt=1 
> since
> the time scale is irrelevant. You will generate a pseudo velocity from 
> which
> positions are updated. The steps are:
> 1. normal time step with ERP = 0
> 2. update position and velocity
> 3. special time step with nonzero ERP, no external forces and zero 
> initial
> velocity
> 4. use the pseudo velocities from 3 to update the positions.

I decided to start playing around with this sort of thing tonight and
figured I'd report my preliminary results.  So far I've been quite
pleased.  To whet your appetite, here's a little movie.  It's nothing
special, just a variation on the usual falling objects theme, but if
you're like me and are fed up with the inescapable bounciness of ODE
then you may find it fun.  No pesky bounce!


I chose to do it in the opposite order for now, first doing a pass with
nonzero ERP but no external forces and then doing a second pass with
zero ERP.  I remember having a vague rationalle for that at the time, 
that was like four hours ago and my memory doesn't work that well. :)  
any rate it seems to work fine this way too.

For now I decided to avoid modifying the stepping function altogether.
I just save and twiddle the body and joint state as appropriate to set 
the first pass, call the stepper, twiddle the state again for the second
pass, call the stepper again, and then set the final state based on the
two results.  You have to deal with not only the external forces in the
force accumulators but also the joint motors and so forth.  The 
to structuring it this way (rather than actually modifying the stepper) 
that it is *hella* easy to implement, and just as easy to vary the 

I'm being a little vague because I'm still messing around; once I've 
had a
little more time to explore I'll describe more specifically what I've 
works well for my applications.  If others do the same then maybe we can
converge on a patch of some sort.  It does roughly double the 
time, so we'll have to think about how to approach it.  (My applications
tend to be collision-dominated anyway, so I don't much care about that.)

Fun fun!


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

More information about the ODE mailing list