[ODE] Problem with rotating spheres

Peggy Skelly mxs70 at po.cwru.edu
Wed Mar 26 10:24:02 2003


Bjoern,

I think your code is fine. It works as you described it. I had to change "dWorldCreate(0)" to "dWorldCreate()", though, I don't think that has anything to do with the sphere rolling and apparrently gaining energy. 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. The time step you're using also affects how much error builds up over 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. 

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. A simple solution might be to apply a force proportional to the big sphere's velocity opposing its motion. You might look in the archives for a previous discussion about slowing down a sphere rolling on a surface like grass.

Peggy

>Hi all,
>
>okay, it seems that I'm not that good in describing my problem :-). So here
>is a small demo program which shows you what I mean.
>
>Thanks for your help!
>
>Bjoern Mahn.
>
>/*
> * This is a small demonstration program which should show a strange
> * behavior of ODE with rotating spheres.
> *
> * There are two Spheres which are connected with a "fixed" hinge joint, which
> * means that the joint stop parameters are both 0. The first sphere lies on
> * the ground, which is in the same space as the Sphere1 (space1). The
> * second sphere is put into a seperate space (space2) so that it doesn't
> * collide neither with the ground nor with the sphere1.
> *
> * Now if you start the simulation, you will see that the sphere2's pendular
> * behavior is not physically correct. It gains more and more energy and
> * oscillates higher and higher. After the system has "exploded", ODE gives
> * the following Message:
> *
> * "ODE Message 2: vector has zero size in dNormalize4()"
> *
> * ... so why?
> */