[ODE] Curious behavior with a simple gravity example

jcwode@nym.hush.com jcwode at nym.hush.com
Wed Jan 24 08:53:41 MST 2007


After looking at it further, I've discovered a simpler way to 
demonstrate the issue.

If I use dWorldQuickStep(), the displacement is always twice as 
much as the correct value, regardless of the number of iterations.

The most clear symptom of the issue is that the result of:

for (int i = 0; i < steps; ++i) {
  dWorldStep(world, time/steps);
}

VARIES based on the value of "steps".  

To me, this is a serious issue.  Why would a simple body, 
accelerated only by gravity, move differently depending on the 
resolution of the step taken when the total time covered by the 
steps is constant?

Someone did respond, but his response wasn't CC'd to the list, but 
he suggested that could be that the calculations are done as so:

v1 = v0 + a*t;
p1 = p0 + v1 * t;

And indeed, the empirical results of dWorldStep suggest that is the 
case.  Furthermore, this method would be wrong.  But the code in 
step.cpp and util.cpp seem to suggest that it's not calculated in 
this manner (at a glance).  Though, why it gives results as it does 
is a mystery to me.

He also suggested to just halve the value of gravity.  This is a 
non-starter.  If this behavior is due to code in step.cpp, that 
might fix the gravity issue, but any other forces in the world 
would be treated in error.

Congratulations on the 0.8 release candidate. :) Maybe I'll take a 
look at that one and see if any of the changes there would affect 
this behavior.

-Josh

On Tue, 23 Jan 2007 09:59:04 -0800 jcwode at nym.hush.com wrote:
>My apologies if this question hits the list twice.  My email 
>provider seemed to be having some issues last night.
>
>Hi,
>
>I've recently been working with ODE v0.7.  This is my first
>experience with ODE, so I'm hoping that what I'm seeing can easily
>be explained by someone with more experience than I have.
>
>I've created a simulation, almost like an ODE "Hello World", with 
>a
>single World and a single Body.  There is only one force in the
>simulation, that being the World's gravity.
>
>Regardless of what step function, running time, or step size that 
>I
>use, I always see the same strange behavior.  The body always
>overshoots its expected final position.  However, it always
>overshoots in a predictable manner.  If I average its final
>position and its position prior to the last step, I get the value
>that I was looking for (the correct one).  Has anyone seen this
>before?
>
>I've written up a similar explanation and posted sample code here:
>
>http://ode.petrucci.ch/viewtopic.php?p=1924
>
>I'm hoping that's it's an error on my part, and that someone here 
>has some insight.
>
>Thanks for any suggestions,
>Josh
>
>_______________________________________________
>ODE mailing list
>ODE at ode.org
>http://mooshika.org/mailman/listinfo/ode



More information about the ODE mailing list