[ODE] Simulations running in real time?

Chris Royce croyce at ntlworld.com
Tue Mar 29 18:15:24 MST 2005


Thanks for the help there Megan I have that implemented now.

Since making things run at real times, it's all acting a little different.

What sort of values should I be using for gravity etc. As before I added 
this constant time algorithm I was using something like -0.0005.

Should I be using real values now, i.e. -9.81 ?

When I use that I notice that the blocks fall through the ground a little 
when they fall, I assume this is due to too low a CFM/ERP values. Any one 
got any suggestions for what values I should be using ?

Many Thanks

Chris

----- Original Message ----- 
From: "Megan Fox" <shalinor at gmail.com>
To: "Chris Royce" <croyce at ntlworld.com>
Cc: "ode" <ode at q12.org>
Sent: Tuesday, March 29, 2005 5:54 PM
Subject: Re: [ODE] Simulations running in real time?


> 60hz (stepsize of 0.016) is the usually-cited recommendation, and
> iters is just something I used in my own code for various debugging
> and haven't bothered to remove yet.
>
> -Megan Fox
>
> On Tue, 29 Mar 2005 17:50:51 +0100, Chris Royce <croyce at ntlworld.com> 
> wrote:
>> Thanks so much for your reply, what is the iters value for? or is that 
>> just
>> for debugging.
>>
>> I pretty much follow the way your algorithm works,
>>
>> so totalTime is only set as 0 when program is initially started, 
>> constantly
>> varies depending on the speed of the application. What would you suggest 
>> as
>> a good step size?
>>
>> Thanks again Megan.
>>
>> Chris
>>
>> ----- Original Message -----
>> From: "Megan Fox" <shalinor at gmail.com>
>> To: "Chris Royce" <croyce at ntlworld.com>
>> Cc: "ode" <ode at q12.org>
>> Sent: Tuesday, March 29, 2005 5:44 PM
>> Subject: Re: [ODE] Simulations running in real time?
>>
>> > deltaTime is, as you deduced, the frame time, the time passed since
>> > the last cycle.  totalTime is just a variable that starts off at 0 to
>> > which I add the deltaTIme each frame, and from which I subtract the
>> > time step until it is below the time step's size.
>> >
>> > I do this because it doesn't lose time this way.  Imagine if you had a
>> > timestep of size 0.016, and then a delta time of 0.015 came up.
>> > Consistently.
>> >
>> > You would want to carry that 0.015 to the next frame (because you
>> > didn't have enough time to run a physics step yet), add the next delta
>> > time, making your totalTime 0.03, and THEN run a physics step,
>> > subtract your deltaTIme, and pass the remaining 0.014 total time into
>> > the next cycle.
>> >
>> > If you don't do it this way (or a similar way), you lose time, and
>> > your system fails to operate in real-time.
>> >
>> > -Megan Fox
>> >
>> >
>> > On Tue, 29 Mar 2005 17:27:36 +0100, Chris Royce <croyce at ntlworld.com>
>> > wrote:
>> >> In this example what is totalTime and deltaTime.
>> >>
>> >> deltaTime is this the time taken for the simLoop method to be run ?
>> >>
>> >> totalTime is defined as what.
>> >>
>> >> Sorry im a little lost on which is which.
>> >>
>> >> Cheers
>> >>
>> >> Chris
>> >>
>> >> ----- Original Message -----
>> >> From: "Megan Fox" <shalinor at gmail.com>
>> >> To: "Hampus Soderstrom" <hampus at sxp.se>
>> >> Cc: <ode at q12.org>
>> >> Sent: Monday, March 28, 2005 6:25 PM
>> >> Subject: Re: [ODE] Simulations running in real time?
>> >>
>> >> > Just use code something like this:
>> >> >
>> >> >    // Make sure time is accrued properly for the phys step count
>> >> >    this->totalTime += deltaTime;
>> >> >
>> >> >    // Then advance the world up to present time
>> >> >    unsigned int iters = 0;
>> >> >    while(this->totalTime > PHYS_STEPSIZE)
>> >> >    {
>> >> >         // ... entity processing
>> >> >
>> >> >        nOpende::JointGroupEmpty(this->physContactJointGroupID);
>> >> >        nOpende::SpaceCollide(this->physColSpaceID, this,
>> >> > this->PhysCollisionCallback);
>> >> >
>> >> >        nOpende::WorldQuickStep(this->physWorldID, PHYS_STEPSIZE);
>> >> >
>> >> >        this->totalTime -= PHYS_STEPSIZE;
>> >> >
>> >> >        iters++;
>> >> >    }
>> >> >
>> >> >
>> >> > Very simple.  It runs ODE in real-time with a fixed timestep, 
>> >> > without
>> >> > loosing those fractions of a timestep you'll drop if you're just 
>> >> > doing
>> >> > "if deltatime > X"
>> >> >
>> >> > -Megan Fox
>> >> >
>> >> > On Mon, 28 Mar 2005 22:45:21 +0700, Hampus Soderstrom 
>> >> > <hampus at sxp.se>
>> >> > wrote:
>> >> >> You could also lock he framerate to 60 pfs or something. On a 
>> >> >> computer
>> >> >> that is too slow and can't keep up with the framerate you selected 
>> >> >> it
>> >> >> will run slower though.
>> >> >>
>> >> >> 2005-03-28 kl. 20.28 skrev George Birbilis:
>> >> >>
>> >> >> > use multiple threads
>> >> >> > see a paper at the Novodex website (now called Ageia or 
>> >> >> > something),
>> >> >> > search for Novodex SDK papers and at see the PDF about
>> >> >> > multithreading.
>> >> >> > You can apply similar technique to ODE I suppose
>> >> >> >
>> >> >> > -----
>> >> >> > George Birbilis (birbilis at kagi.com)
>> >> >> > Microsoft Most Valuable Professional
>> >> >> > MVP J# for 2004 & 2005
>> >> >> > http://www.kagi.com/birbilis
>> >> >> > --------------
>> >> >> > ----- Original Message ----- From: "Chris Royce"
>> >> >> > <croyce at ntlworld.com>
>> >> >> > To: "ode" <ode at q12.org>
>> >> >> > Sent: Monday, March 28, 2005 4:10 PM
>> >> >> > Subject: [ODE] Simulations running in real time?
>> >> >> >
>> >> >> >
>> >> >> > Hello there I'm trying to get my simulation to run in real time,
>> >> >> >
>> >> >> > Basically the problem I'm having at the moment is that the
>> >> >> > simulation
>> >> >> > is running at different speeds on different computers. I'm 
>> >> >> > working
>> >> >> > in
>> >> >> > C++ and using the drawStuff interface.
>> >> >> >
>> >> >> > I'm also noticing that by changing the dWorldStep value the 
>> >> >> > motion
>> >> >> > varies quite considerably, whereas I'd expected to run simply 
>> >> >> > faster
>> >> >> > or slower ?
>> >> >> >
>> >> >> > Thanks for any advice
>> >> >> >
>> >> >> > Chris
>> >> >> >
>> >> >> >
>> >> >> > -----------------------------------------------------------------------
>> >> >> > ---------
>> >> >> >
>> >> >> >
>> >> >> >> _______________________________________________
>> >> >> >> ODE mailing list
>> >> >> >> ODE at q12.org
>> >> >> >> http://q12.org/mailman/listinfo/ode
>> >> >> >
>> >> >> > _______________________________________________
>> >> >> > ODE mailing list
>> >> >> > ODE at q12.org
>> >> >> > http://q12.org/mailman/listinfo/ode
>> >> >> >
>> >> >>
>> >> >> _______________________________________________
>> >> >> ODE mailing list
>> >> >> ODE at q12.org
>> >> >> http://q12.org/mailman/listinfo/ode
>> >> >>
>> >> > _______________________________________________
>> >> > ODE mailing list
>> >> > ODE at q12.org
>> >> > http://q12.org/mailman/listinfo/ode
>> >> >
>> >>
>> >>
>> >
>>
>>
> 




More information about the ODE mailing list