Revision: 8865
          http://playerstage.svn.sourceforge.net/playerstage/?rev=8865&view=rev
Author:   hsujohnhsu
Date:     2010-09-02 00:45:39 +0000 (Thu, 02 Sep 2010)

Log Message:
-----------
Hardwire so simulation time starts at DT rather than 0, since ros use t=0 as a 
special case.

Modified Paths:
--------------
    code/gazebo/branches/wg/server/Simulator.cc

Modified: code/gazebo/branches/wg/server/Simulator.cc
===================================================================
--- code/gazebo/branches/wg/server/Simulator.cc 2010-09-02 00:43:39 UTC (rev 
8864)
+++ code/gazebo/branches/wg/server/Simulator.cc 2010-09-02 00:45:39 UTC (rev 
8865)
@@ -656,24 +656,22 @@
 
   world->GetPhysicsEngine()->InitForThread();
 
-  Time step = world->GetPhysicsEngine()->GetStepTime();
-  double physicsUpdateRate = world->GetPhysicsEngine()->GetUpdateRate();
-  Time physicsUpdatePeriod = 1.0 / physicsUpdateRate;
-
   bool userStepped;
   Time diffTime;
   Time currTime;
   Time lastTime = this->GetRealTime();
   struct timespec req, rem;
 
+  // hack for ROS, since ROS uses t=0 for special purpose
+  this->simTime = world->GetPhysicsEngine()->GetStepTime();
 
   while (!this->userQuit)
   {
     //DiagnosticTimer timer("PhysicsLoop Timer ");
-
-
     currTime = this->GetRealTime();
 
+    // performance wise, this is not ideal, move this outside of while loop 
and use signals and slots.
+    Time step = world->GetPhysicsEngine()->GetStepTime();
     userStepped = false;
     if (this->IsPaused())
       this->pauseTime += step;
@@ -697,6 +695,8 @@
     req.tv_sec  = 0;
     req.tv_nsec = 10000;
 
+    double physicsUpdateRate = world->GetPhysicsEngine()->GetUpdateRate();
+    Time physicsUpdatePeriod = 1.0 / physicsUpdateRate;
     // If the physicsUpdateRate < 0, then we should try to match the
     // update rate to real time
     if ( physicsUpdateRate < 0 &&


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to