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

Geoff Carlton gcarlton at iinet.net.au
Wed Apr 13 18:45:09 MST 2005

```Looks great!
If you have time, could you flick your change off and make the another
demo to clearly see the comparison?  Anyway, it looks very solid.

Geoff

Matthew Hancher wrote:

> 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!
>
> http://web.media.mit.edu/~mdh/NoBounce.mpg
>
> 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, but
> that was like four hours ago and my memory doesn't work that well. :)  At
> 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 up
> 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 advantage
> to structuring it this way (rather than actually modifying the
> stepper) is
> that it is *hella* easy to implement, and just as easy to vary the
> details.
>
> I'm being a little vague because I'm still messing around; once I've
> little more time to explore I'll describe more specifically what I've
> found
> 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
> world-stepping
> 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!
>
> mdh
>
> Matt Hancher
> NASA Ames Research Center
> mdh at email.arc.nasa.gov
>
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
>
>
>

```