[ODE] Re: Problem with rotating spheres

david@csworkbench.com david at csworkbench.com
Tue Apr 1 11:19:02 2003


Just to give you a little insight into how ODE works, there's really a
couple different forces at work here.  First, inertia and gravity are
added to the bodies.  This would cause your smaller sphere to fall
straight down.  Then some forces are added to the system to satisfy the
constraints of each joint.  A torque is added to the spheres to keep their
angular velocities aligned, and a force is added to keep their linear
velocities aligned.  Finally, since the constraints are velocity based, an
additional force is required (adjusted by the ERP parameter) to keep their
positions and orientations aligned.  These numerical methods, as well as
ODE in general, are designed first for speed and second for accuracy.  If
physical accuracy is your primary concern, perhaps a more analytical (as
well as slower) approach tailored to your specific system is the better
choice.  However, in ODE's defense, the more complex your system, the more
likely it is for numerical inaccuracies to cancel each other out.

In short, ODE does have an "error" in calculating sphere rotations: they
are simplified to allow for faster execution time.  Trying to simulate
every equation in your physics book explicitly in ODE would slow even
relatively small systems to a crawl.  So all systems are reduced to
gravity, inertia, and limited constraints (even friction is modelled as a
limit to a constraint).

Hope that helps,
David

> Hi,
>
>> It's
>> due to the fact that you are simulating an undamped system with a
>> first order, fixed time step integrator. That means that small errors
>> (even on the order of floating point representation roundoff) will
>> compound over time.
>
> Hmmm, can "small" rounding-error cause this heavy instability?
>
>> The time step you're using also affects how much error builds up ov r
>> time. If you use a smaller time step in dWorldStep(world,delta) then
>> the error builds up more slowly. In the test I ran, with time step =
>> 0.01, the sphere began rolling off to infinity after 2 oscillations;
>> with 0.005, 4 oscillations; with 0.001, > 9.
>
> Yes, but there would be the same phenomenom if there was an error in
> calculating sphere rotations, won't it?
>
>> To create a stable appearing simulation, you need to damp the system,
>> i.e. remove energy from it. You might look into surface friction, but
>> I doubt that will be the complete solution.
>
> No, the friction is dInfinity and a friction=0 will not dump energy but
> will  let the sphere rotate on its place.
>
>> A simple solution might be to apply a
>> force proportional to the big sphere's velocity opposing its motion.
>
> Hmm, but my aim is a most possible physically correct simulation.
> Somehow I  don't believe in setting slips or removing energy "by hand".
> I'm sure, there  is a better possibility.
>
>> You
>> might look in the archives for a previous discussion about slowing
>> down a sphere rolling on a surface like grass.
>
> OK, good idea. Thanks!

This has been implemented as adding damping forces.  There is no support
for rolling friction in ODE at present.

>  Björn.
> _______________________________________________
> ODE mailing list
> ODE@q12.org
> http://q12.org/mailman/listinfo/ode