Hi Bro,
     See this thread please:
     http://www.nabble.com/simulation-vs-real-time-td19772617.html#a22696684
    
     I use Gazebo SVN version, and do a little change in file 
server/Simulator.cc based on the solution provided in above thread:
   
> *in Simulator.cc, function MainLoop() *
> //declare 2 variables at the beginning
> bool syncTime = false;
> double cache = 0;
> ..
> //and replace the following line in the while loop
>
> World::Instance()->Update();
>
> //with
>
> *step *= World::Instance()->GetPhysicsEngine()->GetStepTime(); 
> //resets the step amount
> if ( !syncTime){
>         this->startTime = this->GetWallTime() - simTime; // init real 
> time to be the same as sim time
>         syncTime = true;
> }
> double elapsed = this->GetRealTime() - this->simTime;
> cache += elapsed;
> // steps the ODE by time elapsed in real world since last update using 
> fixed time step
> while(cache >= step)
> {
>         World::Instance()->Update();  
>         cache -= *step*;
> }
> *step *= elapsed - cache; // changes step amount so simTime gets 
> incremented correctly
and recompile the gazebo package. It really works!

           Remember to backup your original gazebo directory before you 
modify the source codes.
           Good Luck
                      yang

ximengzhu wrote:
> Dear all,
> my question is the one of the title of the thread.
> For my purpose I need to use the real time equal to the simulation time.
> This means I need to set at one the multiplier of the real time.
> Anyone knows how to?
> Thanks in advance,
> Ximengzhu
>   


------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Playerstage-gazebo mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-gazebo

Reply via email to