# [ODE] ODE BUG

Andrew Aye AndrewA at terminalreality.com
Thu Oct 20 16:13:00 MST 2005

```I believe the following is true <shrug> IMHO

acceleration = a
velocity is the time integral of acceleration or v(t) = v0 + t*a
position is the time integral of velocity or s(t) = s0 + t*v0 + 0.5*a*t*t

So to be precise, neither of the equations as listed are correct

However, even though its slightly incorrect the way ODE does it is:

Calculate:
v1 = v0 + at ( or in their case v1 = v0 + (inverse Mass) * (Force) *
t )
s1 = s0 + t(v1)

As you can see this will slightly overestimate the integration process.

-----Original Message-----
From: kalikali at tlen.pl [mailto:kalikali at tlen.pl]
Sent: Thursday, October 20, 2005 3:26 PM
To: ode at q12.org
Subject: [ODE] ODE BUG

I think I found some serious bug in ODE.
Position of the body (changed by applied force) is incorrectly calculated.

Position in timestep should be calculated as:

x = x0 + v0 * (t - t0) + 0.5 * a * (t - t0)

Currently it is calculated as:

x = x0 + v0 * (t - t0) + a * (t - t0)

(without * 0.5 !!!!)

//==============================================================

unit util.cpp (dxStepBody)

b->pos[j] += h * b->lvel[j];

//==============================================================

Put some body in field of gravity, and do dWorldQuickStep(,10)
Check body position
Now, do the same, but in loop:
for (i=0;i < 10;i++) dWorldQuickStep(,1)
Check body position
Positions are not the same !!!
This is the problem

//==============================================================

I've made a little patch (currently only for quick step) but I
don't know is this correct.

Lukasz

_______________________________________________
ODE mailing list
ODE at q12.org
http://q12.org/mailman/listinfo/ode
```