[ODE] CFM and timesteps

gl gl at ntlworld.com
Wed Mar 12 10:48:01 2003


The best way to run ODE in real-time is to use a fixed timestep, and simply
execute it often enough to 'catch up' with the amount of time passed since
the last frame.  Using variable timesteps is likely contributing to your
problems.

Quick paste of my own code (you'll get the idea):

  // tick as often as required to stay at 100Hz
  accumulated += time.ElapsedMS();
#ifdef _DEBUG
  // don't try to catch up more than one second if we paused, eg. during
debugging
  if(accumulated > 1000)
   accumulated = 1000;
#endif
  time.Start();
  while(accumulated >= desired_ms)
   {
   TickAll();    // ie. step the world in your case
   accumulated -= desired_ms;
   }
--
gl

----- Original Message -----
From: "amundbørsand" <amund@c2i.net>
To: <ode@q12.org>
Sent: Wednesday, March 12, 2003 5:21 PM
Subject: [ODE] CFM and timesteps


>
> Hi,
> I'm (still) playing with a leaf spring "approximation". It works okay,
> but I have to use global CFM (and ERP) to allow the springs to flex
> along it's length, that is, to let the hinges twist out of their hinge
> axis (rotate (slightly) around other axis than the set hinge axis).
> However, global CFM leads to a whole bunch of unwanted CFM, that is, my
> car is rolling slightly when it's supposed to stand still, the wheels
> can move on their axles and so on. Is there a way to separate this
> without having to use global CFM? Or should I use ball joints with
> AMotors (I've tried, but not quite got it working yet. How do I set it
> up?)
>
> Another issue is that I'm using real time, that is, the timestep is
> never the same. That means I have to recalculate and set the CFM and ERP
> values for all joints they apply to, as well as the global values, for
> each frame. A problem with this (don't know if it's noticeable, though)
> is that a lot of calculations in ODE "sees" one step into the future,
> right? Won't that be wrong if next step is not the same size? Is there a
> way to not have to set the ERP and CFM every frame, a way that is
> automatically stepsize-dependent?
>
>
> --
> amundbørsand <amund@c2i.net>
>
>
> _______________________________________________
> ODE mailing list
> ODE@q12.org
> http://q12.org/mailman/listinfo/ode
>