[ODE] timestep

Tomas Sakalauskas Tomas.Sakalauskas at axel-group.com
Mon Oct 14 02:50:02 2002


Each frame I tried to make as much complete steps as possible and then in
the end perfom step equal to remaining time. I got problems when very small
time steps were remaining. Then I added the time to next frame and used
fixed timesteps, but either precision was not good enough or I had to use
small timesteps, but then it consumed too much CPU. Variable timesteps seem
to be ok if the variation is relatively small (or actually if minimal
timesteps do not get close to 0).

For this I have two timesteps defined - normal and minimal. Each frame I try
to make as much normal steps as possible, if remaining time is more than
minimal, I perform timestep equal to remaining time, otherwise I add the
remainder to next frame.

This way I can control both CPU consumption and precision of simulation -
time error gets no bigger than minimal step.

Writing this message, came up with the following strategy:
- let T be the time needed to simulate.
- calculate how many full steps you can perform this frame - N,
- perform N timesteps lasting T/N, if N=0 and T is too small, just add it to
next frame.

This way timestep varies a little (but gets no more than DESIRED_STEP*2),
and you get small time error only in the case that framerate is faster than
minimal timestep you allow. If you' make N+1 steps lasting T/(N+1) instead,
you will get range (DESIRED_STEP/2, DESIRED_STEP].

Hope that helps,
Tomas

-----Original Message-----
From: John Butterfield [mailto:johnb003@hotmail.com]
Sent: Monday, October 14, 2002 9:17 AM
To: ode@q12.org
Subject: [ODE] timestep


Is there any harm in using variable times for the worldstep?

I'd like to make things based on time not framerate and if I must use a 
constant time interval it seems like I'd have to use mutliple threads which 
would then cause the need for symaphores and it gets ugly from there.  If I 
do a loop each frame for the amount of time that has passed, then I have 
large errors since the time passed could be like 1.5 times the time step.  I

just thought of an idea of truncating and adding the remainder to the next 
frame.  But then I can imagine it being jerky.  The best solution I can 
think of would be if I could just use variable time steps.

_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com

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