[ODE] ODE uses forces that are twice as large as specified. Bug?
baas at ira.uka.de
Thu Jan 13 19:14:48 MST 2005
Jon Watte wrote:
>>pos = (0.000000, 0.000000, -0.001600)
>>vel = (0.000000, 0.000000, -0.040000)
>>The velocity is v=g*dt which is -0.04 for the z component, so that's
>>correct. But the position should be p=0.5*g*dt^2 which should yield a z
>>component of -0.0008 but the z component in the ODE simulation is twice
> If the velocity is 0.04, and acceleration is linear, then physics say
> that you really should have moved by 0.02, as position is just the
> integral of velocity, and with constant acceleration, velocity is a
How did you get a distance of 0.02?
But anyway, it seems you've hit the point. If I take a constant velocity
of 0.04 without acceleration, then the distance traveled is x=v*dt which
yields 0.0016 - which is the value that ODE returned.
So is that like ODE works internally? First, it computes the new
velocity at the end of the time step and then it takes this velocity and
assumes it was constant throughout the entire time step.
> If you think just about the fact that ODE uses a first-order Euler
> integrator, then the body shouldn't have moved at all.
Ah, here's the keyword I was looking for, it's only a *first-order*
Chris Ledwith wrote:
> I think you will find that if you provide a smaller stepsize (say 100 Hz
> instead of the 25 Hz you have used here, you will get a result closer to
> what you'd expect. [...]
Well, in my application I was controlling the position of a body by
calculating the force that's necessary to move the body to a specific
target position. The calculated force was always too large and only if I
divided it by two I got the expected result. So decreasing the step size
wouldn't have any effect on the outcome as this would also affect the
magnitude of the calculated force.
But now as I begin to understand what's going on, it's ok with me to
divide my forces by 2.
It's quite an interesting thing to note that in ODE you have to apply
"physically incorrect" forces to get the "physically correct" behavior.
- Matthias -
More information about the ODE