how to set real time equal to simulation time?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

how to set real time equal to simulation time?

ximengzhu
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
Reply | Threaded
Open this post in threaded view
|

Re: how to set real time equal to simulation time?

Piotr Trojanek
You can take a loot at this patch, it works for me.

https://sourceforge.net/tracker/?func=detail&atid=433166&aid=2720818&group_id=42445

On Tue, May 19, 2009 at 17:57, ximengzhu <[hidden email]> 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
> --
> View this message in context:
> http://www.nabble.com/how-to-set-real-time-equal-to-simulation-time--tp23619214p23619214.html
> Sent from the playerstage-gazebo mailing list archive at Nabble.com.
>
>
>
> ------------------------------------------------------------------------------
> Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
> is a gathering of tech-side developers & brand creativity professionals.
> Meet
> the minds behind Google Creative Lab, Visual Complexity, Processing, &
> iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
> Group, R/GA, & Big Spaceship. http://www.creativitycat.com
> _______________________________________________
> Playerstage-gazebo mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/playerstage-gazebo
>



--
Piotr Trojanek
------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/playerstage-gazebo
Reply | Threaded
Open this post in threaded view
|

Re: how to set real time equal to simulation time?

Cestmir Houska
In reply to this post by ximengzhu
Hi,

I faced the same problem a while ago and nobody seemed to answer me. What
did it for me was uncommenting part of the source code in
server/Simulator.cc - namely in the Simulator::MainLoop() function. I didn't
look at the current source code though, so take this advice as a mere hint.

Regards,

Cestmir "CZestmyr" Houska

On Tue, May 19, 2009 at 5:57 PM, ximengzhu <[hidden email]> 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
> --
> View this message in context:
> http://www.nabble.com/how-to-set-real-time-equal-to-simulation-time--tp23619214p23619214.html
> Sent from the playerstage-gazebo mailing list archive at Nabble.com.
>
>
>
> ------------------------------------------------------------------------------
> Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
> is a gathering of tech-side developers & brand creativity professionals.
> Meet
> the minds behind Google Creative Lab, Visual Complexity, Processing, &
> iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
> Group, R/GA, & Big Spaceship. http://www.creativitycat.com
> _______________________________________________
> Playerstage-gazebo mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/playerstage-gazebo
>
------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/playerstage-gazebo
Reply | Threaded
Open this post in threaded view
|

Re: how to set real time equal to simulation time?

Nate Koenig
Hello,

The latest SVN version of gazebo now lets to control the physics update loop.

Use the follow tags:

<physics:ode>
  <updateRate> # </updateRate>
</physics:ode>

The number you set updateRate to follows these rules:

< 0 : Gazebo will attempt to run the simulation in real time
0 : Gazebo will run as fast as it can
> 0: This number will represent the desired physics update frequency.


-nate

On Tue, May 26, 2009 at 6:17 AM, Cestmir Houska <[hidden email]> wrote:

> Hi,
>
> I faced the same problem a while ago and nobody seemed to answer me. What
> did it for me was uncommenting part of the source code in
> server/Simulator.cc - namely in the Simulator::MainLoop() function. I didn't
> look at the current source code though, so take this advice as a mere hint.
>
> Regards,
>
> Cestmir "CZestmyr" Houska
>
> On Tue, May 19, 2009 at 5:57 PM, ximengzhu <[hidden email]> 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
>> --
>> View this message in context:
>> http://www.nabble.com/how-to-set-real-time-equal-to-simulation-time--tp23619214p23619214.html
>> Sent from the playerstage-gazebo mailing list archive at Nabble.com.
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
>> is a gathering of tech-side developers & brand creativity professionals.
>> Meet
>> the minds behind Google Creative Lab, Visual Complexity, Processing, &
>> iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
>> Group, R/GA, & Big Spaceship. http://www.creativitycat.com
>> _______________________________________________
>> Playerstage-gazebo mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/playerstage-gazebo
>>
> ------------------------------------------------------------------------------
> 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
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/playerstage-gazebo
>

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/playerstage-gazebo
Reply | Threaded
Open this post in threaded view
|

Re: how to set real time equal to simulation time?

ysong
In reply to this post by ximengzhu
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/playerstage-gazebo