Revision: 8433
http://playerstage.svn.sourceforge.net/playerstage/?rev=8433&view=rev
Author: natepak
Date: 2009-11-22 20:15:37 +0000 (Sun, 22 Nov 2009)
Log Message:
-----------
Added a timer. Made lots of things use gazebo Time class
Modified Paths:
--------------
code/gazebo/trunk/cmake/SearchForStuff.cmake
code/gazebo/trunk/libgazebo/Iface.cc
code/gazebo/trunk/server/CMakeLists.txt
code/gazebo/trunk/server/Simulator.cc
code/gazebo/trunk/server/Simulator.hh
code/gazebo/trunk/server/Time.cc
code/gazebo/trunk/server/Time.hh
code/gazebo/trunk/server/World.cc
code/gazebo/trunk/server/World.hh
code/gazebo/trunk/server/controllers/Controller.cc
code/gazebo/trunk/server/controllers/Controller.hh
code/gazebo/trunk/server/controllers/actarray/bandit/Bandit_Actarray.cc
code/gazebo/trunk/server/controllers/actarray/generic/Generic_Actarray.cc
code/gazebo/trunk/server/controllers/bumper/generic/Generic_Bumper.cc
code/gazebo/trunk/server/controllers/camera/generic/Generic_Camera.cc
code/gazebo/trunk/server/controllers/camera/stereo/Stereo_Camera.cc
code/gazebo/trunk/server/controllers/gripper/pioneer2/Pioneer2_Gripper.cc
code/gazebo/trunk/server/controllers/irarray/IR_Array.cc
code/gazebo/trunk/server/controllers/laser/sicklms200/SickLMS200_Laser.cc
code/gazebo/trunk/server/controllers/opaque/jointforce/JointForce.cc
code/gazebo/trunk/server/controllers/position2d/differential/Differential_Position2d.cc
code/gazebo/trunk/server/controllers/position2d/differential/Differential_Position2d.hh
code/gazebo/trunk/server/controllers/position2d/holonome3sw/Holonome3Sw_Position2d.cc
code/gazebo/trunk/server/controllers/position2d/steering/Steering_Position2d.cc
code/gazebo/trunk/server/controllers/ptz/generic/Generic_PTZ.cc
code/gazebo/trunk/server/gui/GLWindow.cc
code/gazebo/trunk/server/gui/GLWindow.hh
code/gazebo/trunk/server/gui/StatusBar.cc
code/gazebo/trunk/server/gui/StatusBar.hh
code/gazebo/trunk/server/physics/Contact.hh
code/gazebo/trunk/server/physics/PhysicsEngine.cc
code/gazebo/trunk/server/physics/PhysicsEngine.hh
code/gazebo/trunk/server/physics/bullet/BulletPhysics.cc
code/gazebo/trunk/server/physics/bullet/BulletPhysics.hh
code/gazebo/trunk/server/physics/ode/ODEJoint.cc
code/gazebo/trunk/server/physics/ode/ODEPhysics.cc
code/gazebo/trunk/server/rendering/OgreCamera.cc
code/gazebo/trunk/server/rendering/OgreCamera.hh
code/gazebo/trunk/server/sensors/Sensor.cc
code/gazebo/trunk/server/sensors/Sensor.hh
Modified: code/gazebo/trunk/cmake/SearchForStuff.cmake
===================================================================
--- code/gazebo/trunk/cmake/SearchForStuff.cmake 2009-11-22 00:28:04 UTC
(rev 8432)
+++ code/gazebo/trunk/cmake/SearchForStuff.cmake 2009-11-22 20:15:37 UTC
(rev 8433)
@@ -217,7 +217,6 @@
MESSAGE (STATUS "Boost Library Path: ${boost_library_dirs}")
MESSAGE (STATUS "Boost Libraries: ${boost_libraries}")
-
########################################
# For Threadpool
message (STATUS "Threadpool Include Path: ${threadpool_include_dirs}")
Modified: code/gazebo/trunk/libgazebo/Iface.cc
===================================================================
--- code/gazebo/trunk/libgazebo/Iface.cc 2009-11-22 00:28:04 UTC (rev
8432)
+++ code/gazebo/trunk/libgazebo/Iface.cc 2009-11-22 20:15:37 UTC (rev
8433)
@@ -314,10 +314,8 @@
// Print the name, version info
std::cout << "opening " << this->filename.c_str() << " "
-
<< std::setiosflags(std::ios::hex | std::ios::showbase)
<< std::setw(3) << ((GazeboData*) this->mMap)->version << " "
-
<< std::setiosflags(std::ios::dec | ~std::ios::showbase)
<< ((GazeboData*) this->mMap)->size << "\n";
Modified: code/gazebo/trunk/server/CMakeLists.txt
===================================================================
--- code/gazebo/trunk/server/CMakeLists.txt 2009-11-22 00:28:04 UTC (rev
8432)
+++ code/gazebo/trunk/server/CMakeLists.txt 2009-11-22 20:15:37 UTC (rev
8433)
@@ -61,6 +61,7 @@
XMLConfig.cc
GazeboConfig.cc
Time.cc
+ Timer.cc
Entity.cc
GazeboError.cc
GazeboMessage.cc
@@ -90,6 +91,7 @@
SingletonT.hh
StaticPluginRegister.hh
Time.hh
+ Timer.hh
Vector2.hh
Vector3.hh
Vector4.hh
Modified: code/gazebo/trunk/server/Simulator.cc
===================================================================
--- code/gazebo/trunk/server/Simulator.cc 2009-11-22 00:28:04 UTC (rev
8432)
+++ code/gazebo/trunk/server/Simulator.cc 2009-11-22 20:15:37 UTC (rev
8433)
@@ -30,6 +30,7 @@
#include <boost/bind.hpp>
#include <boost/thread/recursive_mutex.hpp>
+#include "Timer.hh"
#include "Body.hh"
#include "Geom.hh"
#include "Model.hh"
@@ -332,10 +333,11 @@
{
this->state = RUN;
- double currTime = 0;
- double lastTime = 0;
+ Time currTime = 0;
+ Time lastTime = 0;
double freq = 80.0;
+
#ifdef TIMING
double tmpT1 = this->GetWallTime();
std::cout << "--------------------------- START Simulator::MainLoop()
--------------------------" << std::endl;
@@ -370,18 +372,18 @@
if (currTime - lastTime < 1/freq)
{
- double sleepTime = (1/freq - (currTime - lastTime));
- timeSpec.tv_sec = (int)(sleepTime);
- timeSpec.tv_nsec = (sleepTime - timeSpec.tv_sec) *1e9;
+ Time sleepTime = ( Time(1.0/freq) - (currTime - lastTime));
+ timeSpec.tv_sec = sleepTime.sec;
+ timeSpec.tv_nsec = sleepTime.nsec;
nanosleep(&timeSpec, NULL);
}
}
else
{
- double sleepTime = (1/freq - (currTime - lastTime));
- timeSpec.tv_sec = (int)(sleepTime);
- timeSpec.tv_nsec = (sleepTime - timeSpec.tv_sec) *1e9;
+ Time sleepTime = ( Time(1.0/freq) - (currTime - lastTime));
+ timeSpec.tv_sec = sleepTime.sec;
+ timeSpec.tv_nsec = sleepTime.nsec;
nanosleep(&timeSpec, NULL);
}
}
@@ -431,49 +433,50 @@
////////////////////////////////////////////////////////////////////////////////
// Get the simulation time
-double Simulator::GetSimTime() const
+gazebo::Time Simulator::GetSimTime() const
{
return this->simTime;
}
////////////////////////////////////////////////////////////////////////////////
/// Set the sim time
-void Simulator::SetSimTime(double t)
+void Simulator::SetSimTime(Time t)
{
this->simTime = t;
}
////////////////////////////////////////////////////////////////////////////////
// Get the pause time
-double Simulator::GetPauseTime() const
+gazebo::Time Simulator::GetPauseTime() const
{
return this->pauseTime;
}
////////////////////////////////////////////////////////////////////////////////
/// Get the start time
-double Simulator::GetStartTime() const
+gazebo::Time Simulator::GetStartTime() const
{
return this->startTime;
}
////////////////////////////////////////////////////////////////////////////////
/// Get the real time (elapsed time)
-double Simulator::GetRealTime() const
+gazebo::Time Simulator::GetRealTime() const
{
return this->GetWallTime() - this->startTime;
}
////////////////////////////////////////////////////////////////////////////////
/// Get the wall clock time
-double Simulator::GetWallTime() const
+gazebo::Time Simulator::GetWallTime() const
{
- struct timeval tv;
- gettimeofday(&tv, NULL);
- return tv.tv_sec + tv.tv_usec * 1e-6;
+ Time t;
+ t.SetToWallTime();
+ return t;
}
-
+////////////////////////////////////////////////////////////////////////////////
+// Set the user quit flag
void Simulator::SetUserQuit()
{
// this->Save("test.xml");
@@ -626,20 +629,23 @@
world->GetPhysicsEngine()->InitForThread();
- double step = world->GetPhysicsEngine()->GetStepTime();
+ Time step = world->GetPhysicsEngine()->GetStepTime();
double physicsUpdateRate = world->GetPhysicsEngine()->GetUpdateRate();
- double physicsUpdatePeriod = 1.0 / physicsUpdateRate;
+ Time physicsUpdatePeriod = 1.0 / physicsUpdateRate;
bool userStepped;
- double diffTime;
- double currTime;
- double lastTime = this->GetRealTime();
+ Time diffTime;
+ Time currTime;
+ Time lastTime = this->GetRealTime();
struct timespec req, rem;
+ Timer timer(Timer::REAL_TIMER);
+
while (!this->userQuit)
{
+
#ifdef TIMING
- double tmpT1 = this->GetWallTime();
+ timer.Start();
#endif
currTime = this->GetRealTime();
@@ -667,16 +673,17 @@
{
boost::recursive_mutex::scoped_lock lock(*this->mutex);
+
#ifdef TIMING
- double tmpT2 = Simulator::Instance()->GetWallTime();
- std::cout << " LOCK DT(" << tmpT2-tmpT1 << ")" << std::endl;
+ timer.Report("Lock DT");
+ //double tmpT2 = Simulator::Instance()->GetWallTime();
+ //std::cout << " LOCK DT(" << tmpT2-tmpT1 << ")" << std::endl;
#endif
world->Update();
}
#ifdef TIMING
- double tmpT2 = Simulator::Instance()->GetWallTime();
- std::cout << " World::Update() DT(" << tmpT2-tmpT1 << ")" << std::endl;
+ std::cout << " World::Update() DT(" << timer << ")" << std::endl;
#endif
currTime = this->GetRealTime();
@@ -692,9 +699,9 @@
this->GetRealTime())
{
diffTime = (this->GetSimTime() + this->GetPauseTime()) -
- this->GetRealTime();
- req.tv_sec = (int) floor(diffTime);
- req.tv_nsec = (int) (fmod(diffTime, 1.0) * 1e9);
+ this->GetRealTime();
+ req.tv_sec = diffTime.sec;
+ req.tv_nsec = diffTime.nsec;
}
// Otherwise try to match the update rate to the one specified in
// the xml file
@@ -703,8 +710,8 @@
{
diffTime = physicsUpdatePeriod - (currTime - lastTime);
- req.tv_sec = (int) floor(diffTime);
- req.tv_nsec = (int) (fmod(diffTime, 1.0) * 1e9);
+ req.tv_sec = diffTime.sec;
+ req.tv_nsec = diffTime.nsec;
}
nanosleep(&req, &rem);
@@ -713,8 +720,7 @@
world->UpdateSimulationIface();
#ifdef TIMING
- double tmpT3 = Simulator::Instance()->GetWallTime();
- std::cout << " World::UpdatSimulationIface() DT(" << tmpT3-tmpT2 << ")" <<
std::endl;
+ std::cout << " World::UpdatSimulationIface() DT(" << timer << ")" <<
std::endl;
#endif
if (this->timeout > 0 && this->GetRealTime() > this->timeout)
@@ -730,9 +736,7 @@
}
#ifdef TIMING
- double tmpT4 = this->GetWallTime();
- std::cout << " Simulator::PhysicsLoop() DT(" << tmpT4-tmpT1
- << ")" << std::endl;
+ std::cout << " Simulator::PhysicsLoop() DT(" << timer << ")" << std::endl;
#endif
}
}
Modified: code/gazebo/trunk/server/Simulator.hh
===================================================================
--- code/gazebo/trunk/server/Simulator.hh 2009-11-22 00:28:04 UTC (rev
8432)
+++ code/gazebo/trunk/server/Simulator.hh 2009-11-22 20:15:37 UTC (rev
8433)
@@ -30,6 +30,7 @@
#include <boost/thread.hpp>
#include <boost/signal.hpp>
+#include "Time.hh"
#include "SingletonT.hh"
namespace boost
@@ -103,26 +104,26 @@
/// Get the simulation time
/// \return The simulation time
- public: double GetSimTime() const;
+ public: Time GetSimTime() const;
/// \brief Set the sim time
- public: void SetSimTime(double t);
+ public: void SetSimTime(Time t);
/// Get the pause time
/// \return The pause time
- public: double GetPauseTime() const;
+ public: Time GetPauseTime() const;
/// Get the start time
/// \return The start time
- public: double GetStartTime() const;
+ public: Time GetStartTime() const;
/// Get the real time (elapsed time)
/// \return The real time
- public: double GetRealTime() const;
+ public: Time GetRealTime() const;
/// \brief Get the wall clock time
/// \return The wall clock time
- public: double GetWallTime() const;
+ public: Time GetWallTime() const;
//User Iteractions
/// \brief Simulator finished by the user
@@ -203,7 +204,7 @@
private: bool pause;
/// Current simulation time
- private: double simTime, pauseTime, startTime;
+ private: Time simTime, pauseTime, startTime;
//upper limits on updating
//how many updates we have done in this slot
Modified: code/gazebo/trunk/server/Time.cc
===================================================================
--- code/gazebo/trunk/server/Time.cc 2009-11-22 00:28:04 UTC (rev 8432)
+++ code/gazebo/trunk/server/Time.cc 2009-11-22 20:15:37 UTC (rev 8433)
@@ -25,6 +25,7 @@
*/
#include <sys/time.h>
+#include <math.h>
#include "Time.hh"
using namespace gazebo;
@@ -33,11 +34,11 @@
Time::Time()
{
this->sec=0;
- this->usec=0;
+ this->nsec=0;
}
Time::Time( const Time &time )
- : sec(time.sec), usec(time.usec)
+ : sec(time.sec), nsec(time.nsec)
{
this->Correct();
}
@@ -45,11 +46,11 @@
Time::Time( const struct timeval &tv )
{
this->sec = tv.tv_sec;
- this->usec = tv.tv_usec;
+ this->nsec = tv.tv_usec*1000;
}
-Time::Time( int sec, int usec )
- : sec(sec), usec(usec)
+Time::Time( int32_t sec, int32_t nsec )
+ : sec(sec), nsec(nsec)
{
this->Correct();
}
@@ -76,32 +77,32 @@
*this = this->GetWallTime();
}
-void Time::Set( int sec, int usec )
+void Time::Set( int32_t sec, int32_t nsec )
{
this->sec = sec;
- this->usec = usec;
+ this->nsec = nsec;
this->Correct();
}
void Time::Set(double seconds)
{
- this->sec = (int)(seconds);
- this->usec = (int)((seconds - this->sec) * 1e3);
+ this->sec = (int32_t)(floor(seconds));
+ this->nsec = (int32_t)(round(seconds - this->sec) * 1e9);
this->Correct();
}
double Time::Double() const
{
- return (this->sec + this->usec*1e-3);
+ return ((double)this->sec + (double)this->nsec*1e-9);
}
// Equal opeators
const Time &Time::operator=( const struct timeval &tv )
{
this->sec = tv.tv_sec;
- this->usec = tv.tv_usec;
+ this->nsec = tv.tv_usec*1000;
return *this;
}
@@ -109,7 +110,7 @@
const Time &Time::operator=( const Time &time )
{
this->sec = time.sec;
- this->usec = time.usec;
+ this->nsec = time.nsec;
return *this;
}
@@ -117,7 +118,7 @@
// Addition operators
Time Time::operator +( const struct timeval &tv ) const
{
- Time t(this->sec + tv.tv_sec, this->usec + tv.tv_usec);
+ Time t(this->sec + tv.tv_sec, this->nsec + tv.tv_usec*1000);
t.Correct();
return t;
}
@@ -125,14 +126,14 @@
const Time &Time::operator +=( const struct timeval &tv )
{
this->sec += tv.tv_sec;
- this->usec += tv.tv_usec;
+ this->nsec += tv.tv_usec*1000;
this->Correct();
return *this;
}
Time Time::operator +( const Time &time ) const
{
- Time t(this->sec + time.sec, this->usec + time.usec);
+ Time t(this->sec + time.sec, this->nsec + time.nsec);
t.Correct();
return t;
@@ -141,7 +142,7 @@
const Time &Time::operator +=( const Time &time )
{
this->sec += time.sec;
- this->usec += time.usec;
+ this->nsec += time.nsec;
this->Correct();
return *this;
}
@@ -149,7 +150,7 @@
// Subtraction operators
Time Time::operator -( const struct timeval &tv ) const
{
- Time t(this->sec-tv.tv_sec, this->usec-tv.tv_usec);
+ Time t(this->sec-tv.tv_sec, this->nsec-tv.tv_usec*1000);
t.Correct();
return t;
@@ -158,14 +159,14 @@
const Time &Time::operator -=( const struct timeval &tv )
{
this->sec -= tv.tv_sec;
- this->usec -= tv.tv_usec;
+ this->nsec -= tv.tv_usec*1000;
this->Correct();
return *this;
}
Time Time::operator -( const Time &time ) const
{
- Time t(this->sec-time.sec, this->usec-time.usec);
+ Time t(this->sec-time.sec, this->nsec-time.nsec);
t.Correct();
return t;
}
@@ -173,7 +174,7 @@
const Time &Time::operator -=( const Time &time )
{
this->sec -= time.sec;
- this->usec -= time.usec;
+ this->nsec -= time.nsec;
this->Correct();
return *this;
}
@@ -181,7 +182,7 @@
// Multiplication operators
Time Time::operator *( const struct timeval &tv ) const
{
- Time t(this->sec * tv.tv_sec, this->usec * tv.tv_usec);
+ Time t(this->sec * tv.tv_sec, this->nsec * tv.tv_usec*1000);
t.Correct();
return t;
}
@@ -189,14 +190,14 @@
const Time &Time::operator *=( const struct timeval &tv )
{
this->sec *= tv.tv_sec;
- this->usec *= tv.tv_usec;
+ this->nsec *= tv.tv_usec*1000;
this->Correct();
return *this;
}
Time Time::operator *( const Time &time ) const
{
- Time t(this->sec * time.sec, this->usec * time.usec);
+ Time t(this->sec * time.sec, this->nsec * time.nsec);
t.Correct();
return t;
}
@@ -204,7 +205,7 @@
const Time &Time::operator *=( const Time &time )
{
this->sec *= time.sec;
- this->usec *= time.usec;
+ this->nsec *= time.nsec;
this->Correct();
return *this;
}
@@ -212,14 +213,16 @@
// Division operators
Time Time::operator /( const struct timeval &tv ) const
{
- Time t( this->Double() / (tv.tv_sec+ tv.tv_usec*1e-3));
+ Time t2(tv);
+ Time t( this->Double() / t2.Double() );
t.Correct();
return t;
}
const Time &Time::operator /=( const struct timeval &tv )
{
- this->Set( this->Double() / (tv.tv_sec+ tv.tv_usec*1e-3));
+ Time t2(tv);
+ this->Set( this->Double() / t2.Double());
return *this;
}
@@ -237,18 +240,17 @@
// Equality operators
bool Time::operator==( const struct timeval &tv ) const
{
- return this->sec==( int)tv.tv_sec &&
- this->usec==tv.tv_usec;
+ return *this == Time(tv);
}
bool Time::operator==( const Time &time ) const
{
- return this->sec==time.sec && this->usec==time.usec;
+ return this->sec==time.sec && this->nsec==time.nsec;
}
bool Time::operator==( double time ) const
{
- return this->sec+this->usec*1e-3 == time;
+ return *this == Time(time);
}
bool Time::operator!=( const struct timeval &tv ) const
@@ -268,25 +270,23 @@
bool Time::operator<( const struct timeval &tv ) const
{
- return this->sec < ( int)tv.tv_sec ||
- (this->sec==( int)tv.tv_sec && this->usec < tv.tv_usec);
+ return *this < Time(tv);
}
bool Time::operator<( const Time &time ) const
{
return this->sec < time.sec ||
- (this->sec==time.sec && this->usec < time.usec);
+ (this->sec==time.sec && this->nsec < time.nsec);
}
bool Time::operator<( double time ) const
{
- return this->sec+this->usec*1e-3 < time;
+ return *this < Time(time);
}
bool Time::operator<=( const struct timeval &tv ) const
{
- return this->sec <= ( int)tv.tv_sec ||
- (this->sec==( int)tv.tv_sec && this->usec <= tv.tv_usec);
+ return *this <= Time(tv);
}
bool Time::operator<=( const Time &time ) const
@@ -296,13 +296,12 @@
bool Time::operator<=( double time ) const
{
- return this->sec+this->usec*1e-3 <= time;
+ return *this <= Time(time);
}
bool Time::operator>( const struct timeval &tv ) const
{
- return this->sec > (int)tv.tv_sec ||
- (this->sec==( int)tv.tv_sec && this->usec > tv.tv_usec);
+ return *this > Time(tv);
}
bool Time::operator>( const Time &time ) const
@@ -312,13 +311,12 @@
bool Time::operator>( double time ) const
{
- return this->sec+this->usec*1e-3 > time;
+ return *this > Time(time);
}
bool Time::operator>=( const struct timeval &tv ) const
{
- return this->sec >= ( int)tv.tv_sec ||
- (this->sec==( int)tv.tv_sec && this->usec >= tv.tv_usec);
+ return *this >= Time(tv);
}
bool Time::operator>=( const Time &time ) const
@@ -328,32 +326,21 @@
bool Time::operator>=( double time ) const
{
- return this->sec+this->usec*1e-3 >= time;
+ return *this >= Time(time);
}
-std::ostream &operator<<(std::ostream &out, const Time &time)
-{
- out << time.sec << "." << (int)(time.usec*1e-3);
- return out;
-}
-/*std::ofstream &operator<<(std::ofstream &out, const Time &time)
-{
- out << time.sec << "." << (int)(time.usec*1e-3);
- return out;
-}*/
-
void Time::Correct()
{
// Make any corrections
- if (this->usec > 1e6)
+ if (this->nsec > 1e9)
{
this->sec++;
- this->usec = (int)(this->usec - 1e6);
+ this->nsec = (int32_t)(this->nsec - 1e9);
}
- else if (this->usec < 0)
+ else if (this->nsec < 0)
{
this->sec--;
- this->usec = (int)(this->usec + 1e6);
+ this->nsec = (int32_t)(this->nsec + 1e9);
}
}
Modified: code/gazebo/trunk/server/Time.hh
===================================================================
--- code/gazebo/trunk/server/Time.hh 2009-11-22 00:28:04 UTC (rev 8432)
+++ code/gazebo/trunk/server/Time.hh 2009-11-22 20:15:37 UTC (rev 8433)
@@ -53,11 +53,11 @@
/// \brief Constructor
/// \param sec Seconds
- /// \param usec Microseconds
- public: Time( int sec, int usec );
+ /// \param nsec Microseconds
+ public: Time( int32_t sec, int32_t nsec );
/// \brief Constuctor
- /// \param time Time in double format sec.usec
+ /// \param time Time in double format sec.nsec
public: Time( double time );
/// \brief Destructor
@@ -69,10 +69,10 @@
/// \brief Set the time to the wall time
public: void SetToWallTime();
- /// \brief Set to sec and usec
+ /// \brief Set to sec and nsec
/// \param sec Seconds
- /// \param usec micro seconds
- public: void Set( int sec, int usec );
+ /// \param nsec micro seconds
+ public: void Set( int32_t sec, int32_t nsec );
/// \brief Set to seconds
/// \param seconds Number of seconds
@@ -174,13 +174,25 @@
public: bool operator>=( double time ) const;
/// Stream operators
- public: friend std::ostream &operator<<(std::ostream &out, const Time &time);
+ public: friend std::ostream &operator<<(std::ostream &out, const
gazebo::Time &time)
+ {
+ out << time.Double();
+ return out;
+ }
+ public: friend std::istream &operator>>(std::istream &in, gazebo::Time &time)
+ {
+ double t;
+ in >> t;
+ time.Set(t);
+ return in;
+ }
+
/// Seconds
- public: int sec;
+ public: int32_t sec;
/// Microseconds
- public: int usec;
+ public: int32_t nsec;
/// Correct the time
private: void Correct();
Modified: code/gazebo/trunk/server/World.cc
===================================================================
--- code/gazebo/trunk/server/World.cc 2009-11-22 00:28:04 UTC (rev 8432)
+++ code/gazebo/trunk/server/World.cc 2009-11-22 20:15:37 UTC (rev 8433)
@@ -727,9 +727,9 @@
response = this->simIface->data->responses;
- this->simIface->data->simTime = Simulator::Instance()->GetSimTime();
- this->simIface->data->pauseTime = Simulator::Instance()->GetPauseTime();
- this->simIface->data->realTime = Simulator::Instance()->GetRealTime();
+ this->simIface->data->simTime = Simulator::Instance()->GetSimTime().Double();
+ this->simIface->data->pauseTime =
Simulator::Instance()->GetPauseTime().Double();
+ this->simIface->data->realTime =
Simulator::Instance()->GetRealTime().Double();
this->simIface->data->state = !Simulator::Instance()->IsPaused();
unsigned int requestCount = this->simIface->data->requestCount;
@@ -1266,7 +1266,7 @@
case SimulationRequestData::GO:
{
this->simPauseTime = Simulator::Instance()->GetSimTime()
- + req->runTime * 10e-6;
+ + Time(req->runTime);
Simulator::Instance()->SetPaused(false);
break;
Modified: code/gazebo/trunk/server/World.hh
===================================================================
--- code/gazebo/trunk/server/World.hh 2009-11-22 00:28:04 UTC (rev 8432)
+++ code/gazebo/trunk/server/World.hh 2009-11-22 20:15:37 UTC (rev 8433)
@@ -267,7 +267,7 @@
private: GraphicsIfaceHandler *graphics;
/// Length of time to run before receiving a "go" command
- private: double simPauseTime;
+ private: Time simPauseTime;
private: OpenAL *openAL;
Modified: code/gazebo/trunk/server/controllers/Controller.cc
===================================================================
--- code/gazebo/trunk/server/controllers/Controller.cc 2009-11-22 00:28:04 UTC
(rev 8432)
+++ code/gazebo/trunk/server/controllers/Controller.cc 2009-11-22 20:15:37 UTC
(rev 8433)
@@ -88,7 +88,7 @@
this->updatePeriod = 0.0; // no throttling if updateRate is 0
else
this->updatePeriod = 1.0 / updateRate;
- this->lastUpdate = Simulator::Instance()->GetSimTime();
+ this->lastUpdate = Simulator::Instance()->GetSimTime();
childNode = node->GetChildByNSPrefix("interface");
@@ -195,7 +195,7 @@
if (this->IsConnected() || this->alwaysOnP->GetValue())
{
// round time difference to this->physicsEngine->GetStepTime()
- double physics_dt = World::Instance()->GetPhysicsEngine()->GetStepTime();
+ Time physics_dt = World::Instance()->GetPhysicsEngine()->GetStepTime();
// if (this->GetName() == std::string("p3d_base_controller"))
// std::cout << " sim update: " << this->GetName()
@@ -208,7 +208,8 @@
#ifdef TIMING
double tmpT1 = Simulator::Instance()->GetWallTime();
#endif
- if
(round((Simulator::Instance()->GetSimTime()-lastUpdate-updatePeriod)/physics_dt)
>= 0)
+ Time simTime = Simulator::Instance()->GetSimTime();
+ if ((simTime-lastUpdate-updatePeriod)/physics_dt >= 0)
{
this->UpdateChild();
lastUpdate = Simulator::Instance()->GetSimTime();
Modified: code/gazebo/trunk/server/controllers/Controller.hh
===================================================================
--- code/gazebo/trunk/server/controllers/Controller.hh 2009-11-22 00:28:04 UTC
(rev 8432)
+++ code/gazebo/trunk/server/controllers/Controller.hh 2009-11-22 20:15:37 UTC
(rev 8433)
@@ -123,7 +123,7 @@
private: std::string typeName;
/// \brief Last update time
- protected: double lastUpdate;
+ protected: Time lastUpdate;
/// \brief Array of all the iface for this controller
private: std::vector<Iface*> ifaces;
Modified:
code/gazebo/trunk/server/controllers/actarray/bandit/Bandit_Actarray.cc
===================================================================
--- code/gazebo/trunk/server/controllers/actarray/bandit/Bandit_Actarray.cc
2009-11-22 00:28:04 UTC (rev 8432)
+++ code/gazebo/trunk/server/controllers/actarray/bandit/Bandit_Actarray.cc
2009-11-22 20:15:37 UTC (rev 8433)
@@ -130,7 +130,7 @@
Angle angle;
this->myIface->Lock(1);
- this->myIface->data->head.time = Simulator::Instance()->GetSimTime();
+ this->myIface->data->head.time =
Simulator::Instance()->GetSimTime().Double();
this->myIface->data->actuators_count = JOINTCNT;
Modified:
code/gazebo/trunk/server/controllers/actarray/generic/Generic_Actarray.cc
===================================================================
--- code/gazebo/trunk/server/controllers/actarray/generic/Generic_Actarray.cc
2009-11-22 00:28:04 UTC (rev 8432)
+++ code/gazebo/trunk/server/controllers/actarray/generic/Generic_Actarray.cc
2009-11-22 20:15:37 UTC (rev 8433)
@@ -117,7 +117,7 @@
float actual_speed;
this->myIface->Lock(1);
- this->myIface->data->head.time = Simulator::Instance()->GetSimTime();
+ this->myIface->data->head.time =
Simulator::Instance()->GetSimTime().Double();
this->myIface->data->actuators_count = n_joints;
Modified: code/gazebo/trunk/server/controllers/bumper/generic/Generic_Bumper.cc
===================================================================
--- code/gazebo/trunk/server/controllers/bumper/generic/Generic_Bumper.cc
2009-11-22 00:28:04 UTC (rev 8432)
+++ code/gazebo/trunk/server/controllers/bumper/generic/Generic_Bumper.cc
2009-11-22 20:15:37 UTC (rev 8433)
@@ -76,7 +76,7 @@
this->myIface->data->bumper_count = this->myParent->GetGeomCount();
- this->myIface->data->head.time = Simulator::Instance()->GetRealTime();
+ this->myIface->data->head.time
=Simulator::Instance()->GetRealTime().Double();
for (unsigned int i=0; i < this->myParent->GetGeomCount(); i++)
{
Modified: code/gazebo/trunk/server/controllers/camera/generic/Generic_Camera.cc
===================================================================
--- code/gazebo/trunk/server/controllers/camera/generic/Generic_Camera.cc
2009-11-22 00:28:04 UTC (rev 8432)
+++ code/gazebo/trunk/server/controllers/camera/generic/Generic_Camera.cc
2009-11-22 20:15:37 UTC (rev 8433)
@@ -121,7 +121,7 @@
this->cameraIface->Lock(1);
// Data timestamp
- data->head.time = Simulator::Instance()->GetSimTime();
+ data->head.time = Simulator::Instance()->GetSimTime().Double();
data->width = this->myParent->GetImageWidth();
data->height = this->myParent->GetImageHeight();
Modified: code/gazebo/trunk/server/controllers/camera/stereo/Stereo_Camera.cc
===================================================================
--- code/gazebo/trunk/server/controllers/camera/stereo/Stereo_Camera.cc
2009-11-22 00:28:04 UTC (rev 8432)
+++ code/gazebo/trunk/server/controllers/camera/stereo/Stereo_Camera.cc
2009-11-22 20:15:37 UTC (rev 8433)
@@ -167,7 +167,7 @@
float *disp_dst;
// Data timestamp
- stereo_data->head.time = Simulator::Instance()->GetSimTime();
+ stereo_data->head.time = Simulator::Instance()->GetSimTime().Double();
stereo_data->width = this->myParent->GetImageWidth();
stereo_data->height = this->myParent->GetImageHeight();
@@ -204,7 +204,7 @@
unsigned char *rgb_dst = NULL;
Pose3d cameraPose;
- camera_data->head.time = Simulator::Instance()->GetSimTime();
+ camera_data->head.time = Simulator::Instance()->GetSimTime().Double();
camera_data->width = this->myParent->GetImageWidth();
camera_data->height = this->myParent->GetImageHeight();
Modified:
code/gazebo/trunk/server/controllers/gripper/pioneer2/Pioneer2_Gripper.cc
===================================================================
--- code/gazebo/trunk/server/controllers/gripper/pioneer2/Pioneer2_Gripper.cc
2009-11-22 00:28:04 UTC (rev 8432)
+++ code/gazebo/trunk/server/controllers/gripper/pioneer2/Pioneer2_Gripper.cc
2009-11-22 20:15:37 UTC (rev 8433)
@@ -349,7 +349,7 @@
this->actIface->data->actuators_count = 1;
- this->gripIface->data->head.time = Simulator::Instance()->GetSimTime();
+ this->gripIface->data->head.time =
Simulator::Instance()->GetSimTime().Double();
this->gripIface->Post();
this->gripIface->Unlock();
Modified: code/gazebo/trunk/server/controllers/irarray/IR_Array.cc
===================================================================
--- code/gazebo/trunk/server/controllers/irarray/IR_Array.cc 2009-11-22
00:28:04 UTC (rev 8432)
+++ code/gazebo/trunk/server/controllers/irarray/IR_Array.cc 2009-11-22
20:15:37 UTC (rev 8433)
@@ -109,7 +109,7 @@
if (this->irIface->Lock(1))
{
// Data timestamp
- this->irIface->data->head.time = Simulator::Instance()->GetSimTime();
+ this->irIface->data->head.time =
Simulator::Instance()->GetSimTime().Double();
this->irIface->data->ir_count = this->myParent->GetIRCount();
Modified:
code/gazebo/trunk/server/controllers/laser/sicklms200/SickLMS200_Laser.cc
===================================================================
--- code/gazebo/trunk/server/controllers/laser/sicklms200/SickLMS200_Laser.cc
2009-11-22 00:28:04 UTC (rev 8432)
+++ code/gazebo/trunk/server/controllers/laser/sicklms200/SickLMS200_Laser.cc
2009-11-22 20:15:37 UTC (rev 8433)
@@ -180,7 +180,7 @@
if (this->laserIface->Lock(1))
{
// Data timestamp
- this->laserIface->data->head.time = Simulator::Instance()->GetSimTime();
+ this->laserIface->data->head.time =
Simulator::Instance()->GetSimTime().Double();
// Read out the laser range data
this->laserIface->data->min_angle = minAngle.GetAsRadian();
@@ -244,7 +244,7 @@
if (this->fiducialIface->Lock(1))
{
// Data timestamp
- this->fiducialIface->data->head.time = Simulator::Instance()->GetSimTime();
+ this->fiducialIface->data->head.time =
Simulator::Instance()->GetSimTime().Double();
this->fiducialIface->data->count = 0;
// TODO: clean this up
Modified: code/gazebo/trunk/server/controllers/opaque/jointforce/JointForce.cc
===================================================================
--- code/gazebo/trunk/server/controllers/opaque/jointforce/JointForce.cc
2009-11-22 00:28:04 UTC (rev 8432)
+++ code/gazebo/trunk/server/controllers/opaque/jointforce/JointForce.cc
2009-11-22 20:15:37 UTC (rev 8433)
@@ -87,7 +87,7 @@
void JointForce::UpdateChild()
{
this->myIface->Lock(1);
- this->myIface->data->head.time = Simulator::Instance()->GetSimTime();
+ this->myIface->data->head.time =
Simulator::Instance()->GetSimTime().Double();
// Let me explain this number: each joint reports 4 vectors: Force and torque
// on each jointed object, respectively. These vectors have 3 elements:
x,y,z.
Modified:
code/gazebo/trunk/server/controllers/position2d/differential/Differential_Position2d.cc
===================================================================
---
code/gazebo/trunk/server/controllers/position2d/differential/Differential_Position2d.cc
2009-11-22 00:28:04 UTC (rev 8432)
+++
code/gazebo/trunk/server/controllers/position2d/differential/Differential_Position2d.cc
2009-11-22 20:15:37 UTC (rev 8433)
@@ -153,7 +153,7 @@
double wd, ws;
double d1, d2;
double dr, da;
- double stepTime;
+ Time stepTime;
this->myIface->Lock(1);
@@ -168,8 +168,8 @@
this->prevUpdateTime = Simulator::Instance()->GetSimTime();
// Distance travelled by front wheels
- d1 = stepTime * wd / 2 * this->joints[LEFT]->GetVelocity(0);
- d2 = stepTime * wd / 2 * this->joints[RIGHT]->GetVelocity(0);
+ d1 = stepTime.Double() * wd / 2 * this->joints[LEFT]->GetVelocity(0);
+ d2 = stepTime.Double() * wd / 2 * this->joints[RIGHT]->GetVelocity(0);
dr = (d1 + d2) / 2;
da = (d1 - d2) / ws;
@@ -180,9 +180,9 @@
this->odomPose[2] += da;
// Compute odometric instantaneous velocity
- this->odomVel[0] = dr / stepTime;
+ this->odomVel[0] = dr / stepTime.Double();
this->odomVel[1] = 0.0;
- this->odomVel[2] = da / stepTime;
+ this->odomVel[2] = da / stepTime.Double();
if (this->enableMotors)
{
@@ -229,7 +229,7 @@
void Differential_Position2d::PutPositionData()
{
// TODO: Data timestamp
- this->myIface->data->head.time = Simulator::Instance()->GetSimTime();
+ this->myIface->data->head.time =
Simulator::Instance()->GetSimTime().Double();
this->myIface->data->pose.pos.x = this->odomPose[0];
this->myIface->data->pose.pos.y = this->odomPose[1];
Modified:
code/gazebo/trunk/server/controllers/position2d/differential/Differential_Position2d.hh
===================================================================
---
code/gazebo/trunk/server/controllers/position2d/differential/Differential_Position2d.hh
2009-11-22 00:28:04 UTC (rev 8432)
+++
code/gazebo/trunk/server/controllers/position2d/differential/Differential_Position2d.hh
2009-11-22 20:15:37 UTC (rev 8433)
@@ -115,7 +115,7 @@
private: float wheelSpeed[2];
// Simulation time of the last update
- private: double prevUpdateTime;
+ private: Time prevUpdateTime;
/// True = enable motors
private: bool enableMotors;
Modified:
code/gazebo/trunk/server/controllers/position2d/holonome3sw/Holonome3Sw_Position2d.cc
===================================================================
---
code/gazebo/trunk/server/controllers/position2d/holonome3sw/Holonome3Sw_Position2d.cc
2009-11-22 00:28:04 UTC (rev 8432)
+++
code/gazebo/trunk/server/controllers/position2d/holonome3sw/Holonome3Sw_Position2d.cc
2009-11-22 20:15:37 UTC (rev 8433)
@@ -248,7 +248,7 @@
if (this->myIface->Lock(1))
{
// TODO: Data timestamp
- this->myIface->data->head.time = Simulator::Instance()->GetSimTime();
+ this->myIface->data->head.time =
Simulator::Instance()->GetSimTime().Double();
this->myIface->data->pose.pos.x = this->Xi[0];
this->myIface->data->pose.pos.y = this->Xi[1];
Modified:
code/gazebo/trunk/server/controllers/position2d/steering/Steering_Position2d.cc
===================================================================
---
code/gazebo/trunk/server/controllers/position2d/steering/Steering_Position2d.cc
2009-11-22 00:28:04 UTC (rev 8432)
+++
code/gazebo/trunk/server/controllers/position2d/steering/Steering_Position2d.cc
2009-11-22 20:15:37 UTC (rev 8433)
@@ -227,7 +227,7 @@
if (this->myIface->Lock(1))
{
// TODO: Data timestamp
- this->myIface->data->head.time = Simulator::Instance()->GetSimTime();
+ this->myIface->data->head.time =
Simulator::Instance()->GetSimTime().Double();
this->myIface->data->pose.pos.x = this->odomPose[0];
this->myIface->data->pose.pos.y = this->odomPose[1];
Modified: code/gazebo/trunk/server/controllers/ptz/generic/Generic_PTZ.cc
===================================================================
--- code/gazebo/trunk/server/controllers/ptz/generic/Generic_PTZ.cc
2009-11-22 00:28:04 UTC (rev 8432)
+++ code/gazebo/trunk/server/controllers/ptz/generic/Generic_PTZ.cc
2009-11-22 20:15:37 UTC (rev 8433)
@@ -205,7 +205,7 @@
this->ptzIface->Lock(1);
// Data timestamp
- data->head.time = Simulator::Instance()->GetSimTime();
+ data->head.time = Simulator::Instance()->GetSimTime().Double();
data->pan = this->panJoint->GetAngle(0).GetAsRadian();
data->tilt = this->tiltJoint->GetAngle(0).GetAsRadian();
Modified: code/gazebo/trunk/server/gui/GLWindow.cc
===================================================================
--- code/gazebo/trunk/server/gui/GLWindow.cc 2009-11-22 00:28:04 UTC (rev
8432)
+++ code/gazebo/trunk/server/gui/GLWindow.cc 2009-11-22 20:15:37 UTC (rev
8433)
@@ -155,8 +155,8 @@
{
if (this->activeCamera && this->activeCamera->GetUserMovable())
{
- this->activeCamera->Translate(
- this->directionVec * (Simulator::Instance()->GetRealTime() -
this->lastUpdateTime) );
+ Time diff = Simulator::Instance()->GetRealTime() - this->lastUpdateTime;
+ this->activeCamera->Translate( this->directionVec * diff.Double() );
this->directionVec.Set(0,0,0);
}
Modified: code/gazebo/trunk/server/gui/GLWindow.hh
===================================================================
--- code/gazebo/trunk/server/gui/GLWindow.hh 2009-11-22 00:28:04 UTC (rev
8432)
+++ code/gazebo/trunk/server/gui/GLWindow.hh 2009-11-22 20:15:37 UTC (rev
8433)
@@ -152,7 +152,7 @@
private: Vector3 torqueVec; // for applying external forces
private: std::map<int,int> keys;
- private: double lastUpdateTime;
+ private: Time lastUpdateTime;
private: bool mouseDrag;
Modified: code/gazebo/trunk/server/gui/StatusBar.cc
===================================================================
--- code/gazebo/trunk/server/gui/StatusBar.cc 2009-11-22 00:28:04 UTC (rev
8432)
+++ code/gazebo/trunk/server/gui/StatusBar.cc 2009-11-22 20:15:37 UTC (rev
8433)
@@ -39,6 +39,8 @@
using namespace gazebo;
+gazebo::Time StatusBar::statusUpdatePeriod = 0.05;
+
////////////////////////////////////////////////////////////////////////////////
// Constructor
StatusBar::StatusBar(int x, int y, int w, int h, const char *l)
@@ -104,8 +106,8 @@
void StatusBar::Update()
{
//float percent = 0;
- float sim = 0;
- float real = 0;
+ Time sim = 0;
+ Time real = 0;
if (Simulator::Instance()->GetRealTime() - this->lastUpdateTime >
this->statusUpdatePeriod)
{
@@ -117,9 +119,9 @@
}
else
{
- this->percent =
((Simulator::Instance()->GetSimTime()-this->percentLastSimTime)
- /
(Simulator::Instance()->GetRealTime()-this->percentLastRealTime) );
- this->percentLastRealTime =Simulator::Instance()->GetRealTime();
+ this->percent =
((Simulator::Instance()->GetSimTime()-this->percentLastSimTime) /
(Simulator::Instance()->GetRealTime()-this->percentLastRealTime)).Double();
+
+ this->percentLastRealTime = Simulator::Instance()->GetRealTime();
this->percentLastSimTime = Simulator::Instance()->GetSimTime();
}
@@ -167,11 +169,11 @@
this->realTime->label("(min) Real Time");
}
- this->percentOutput->value(this->percent);
+ this->percentOutput->value(this->percent.Double());
- this->realTime->value(real);
- this->simTime->value(sim);
- this->pauseTime->value(Simulator::Instance()->GetPauseTime());
+ this->realTime->value(real.Double());
+ this->simTime->value(sim.Double());
+ this->pauseTime->value(Simulator::Instance()->GetPauseTime().Double());
this->lastUpdateTime = Simulator::Instance()->GetRealTime();
}
Modified: code/gazebo/trunk/server/gui/StatusBar.hh
===================================================================
--- code/gazebo/trunk/server/gui/StatusBar.hh 2009-11-22 00:28:04 UTC (rev
8432)
+++ code/gazebo/trunk/server/gui/StatusBar.hh 2009-11-22 20:15:37 UTC (rev
8433)
@@ -28,6 +28,8 @@
#include <FL/Fl_Group.H>
+#include "Time.hh"
+
class Fl_Value_Output;
class Fl_Output;
class Fl_Button;
@@ -61,11 +63,11 @@
public: Gui *gui;
- private: double lastUpdateTime;
+ private: Time lastUpdateTime;
// calculated percent speedup in last percentWindowDuration seconds real
time.
- private: double percent, percentLastRealTime, percentLastSimTime;
- private: static const double statusUpdatePeriod = 0.05;
+ private: Time percent, percentLastRealTime, percentLastSimTime;
+ private: static gazebo::Time statusUpdatePeriod;
};
}
Modified: code/gazebo/trunk/server/physics/Contact.hh
===================================================================
--- code/gazebo/trunk/server/physics/Contact.hh 2009-11-22 00:28:04 UTC (rev
8432)
+++ code/gazebo/trunk/server/physics/Contact.hh 2009-11-22 20:15:37 UTC (rev
8433)
@@ -29,6 +29,7 @@
#include <vector>
+#include "Time.hh"
#include "Vector3.hh"
#include "JointFeedback.hh"
@@ -68,7 +69,7 @@
public: std::vector<double> depths;
- public: double time;
+ public: Time time;
};
}
Modified: code/gazebo/trunk/server/physics/PhysicsEngine.cc
===================================================================
--- code/gazebo/trunk/server/physics/PhysicsEngine.cc 2009-11-22 00:28:04 UTC
(rev 8432)
+++ code/gazebo/trunk/server/physics/PhysicsEngine.cc 2009-11-22 20:15:37 UTC
(rev 8433)
@@ -38,7 +38,7 @@
Param::Begin(&this->parameters);
this->gravityP = new ParamT<Vector3>("gravity",Vector3(0.0, -9.80665, 0.0),
0);
this->updateRateP = new ParamT<double>("updateRate", 0.0, 0);
- this->stepTimeP = new ParamT<double>("stepTime",0.025,0);
+ this->stepTimeP = new ParamT<Time>("stepTime",0.025,0);
Param::End();
this->mutex = new boost::recursive_mutex();
@@ -72,9 +72,9 @@
////////////////////////////////////////////////////////////////////////////////
/// Get the time between each update cycle
-double PhysicsEngine::GetStepTime() const
+Time PhysicsEngine::GetStepTime() const
{
- return this->stepTimeP->GetValue();
+ return **this->stepTimeP;
}
////////////////////////////////////////////////////////////////////////////////
Modified: code/gazebo/trunk/server/physics/PhysicsEngine.hh
===================================================================
--- code/gazebo/trunk/server/physics/PhysicsEngine.hh 2009-11-22 00:28:04 UTC
(rev 8432)
+++ code/gazebo/trunk/server/physics/PhysicsEngine.hh 2009-11-22 20:15:37 UTC
(rev 8433)
@@ -135,7 +135,7 @@
/// \brief Get the physics time steps in the virtual world
/// \return step time
- public: double GetStepTime() const;
+ public: Time GetStepTime() const;
/// \brief Lock the physics engine mutex
public: void LockMutex();
@@ -154,7 +154,7 @@
/// time steps the physical engine will take
/// how much time will pass on each update
- protected: ParamT<double> *stepTimeP;
+ protected: ParamT<Time> *stepTimeP;
/// update rate of the physical engine, how many times
/// it is called
Modified: code/gazebo/trunk/server/physics/bullet/BulletPhysics.cc
===================================================================
--- code/gazebo/trunk/server/physics/bullet/BulletPhysics.cc 2009-11-22
00:28:04 UTC (rev 8432)
+++ code/gazebo/trunk/server/physics/bullet/BulletPhysics.cc 2009-11-22
20:15:37 UTC (rev 8433)
@@ -142,15 +142,15 @@
// Update the Bullet engine
void BulletPhysics::UpdatePhysics()
{
- double time = Simulator::Instance()->GetRealTime() - this->lastUpdateTime;
- int steps = time / (**this->stepTimeP);
+ Time time = Simulator::Instance()->GetRealTime() - this->lastUpdateTime;
+ int steps = (int) round( (time / **this->stepTimeP).Double() );
steps = std::max(steps,1);
//time = 0.000001;
//steps = 1;
//this->dynamicsWorld->stepSimulation(time, steps, (**this->stepTimeP));
- this->dynamicsWorld->stepSimulation(**this->stepTimeP);
+ this->dynamicsWorld->stepSimulation((**this->stepTimeP).Double());
this->lastUpdateTime = Simulator::Instance()->GetRealTime();
}
Modified: code/gazebo/trunk/server/physics/bullet/BulletPhysics.hh
===================================================================
--- code/gazebo/trunk/server/physics/bullet/BulletPhysics.hh 2009-11-22
00:28:04 UTC (rev 8432)
+++ code/gazebo/trunk/server/physics/bullet/BulletPhysics.hh 2009-11-22
20:15:37 UTC (rev 8433)
@@ -153,7 +153,7 @@
private: btSequentialImpulseConstraintSolver *solver;
private: btDiscreteDynamicsWorld *dynamicsWorld;
- private: double lastUpdateTime;
+ private: Time lastUpdateTime;
};
/** \}*/
Modified: code/gazebo/trunk/server/physics/ode/ODEJoint.cc
===================================================================
--- code/gazebo/trunk/server/physics/ode/ODEJoint.cc 2009-11-22 00:28:04 UTC
(rev 8432)
+++ code/gazebo/trunk/server/physics/ode/ODEJoint.cc 2009-11-22 20:15:37 UTC
(rev 8433)
@@ -54,7 +54,7 @@
{
Joint::Load(node);
- double h = this->physics->GetStepTime();
+ double h = this->physics->GetStepTime().Double();
double stopErp = h * (**this->stopKpP) / (h * (**this->stopKpP) +
(**this->stopKdP));
double stopCfm = 1.0 / (h * (**this->stopKpP) + (**this->stopKdP));
Modified: code/gazebo/trunk/server/physics/ode/ODEPhysics.cc
===================================================================
--- code/gazebo/trunk/server/physics/ode/ODEPhysics.cc 2009-11-22 00:28:04 UTC
(rev 8432)
+++ code/gazebo/trunk/server/physics/ode/ODEPhysics.cc 2009-11-22 20:15:37 UTC
(rev 8433)
@@ -267,9 +267,9 @@
// Update the dynamical model
if (this->quickStepP->GetValue())
- dWorldQuickStep(this->worldId, this->stepTimeP->GetValue() );
+ dWorldQuickStep(this->worldId, (**this->stepTimeP).Double());
else
- dWorldStep( this->worldId, this->stepTimeP->GetValue() );
+ dWorldStep( this->worldId, (**this->stepTimeP).Double() );
#ifdef TIMING
double tmpT3 = Simulator::Instance()->GetWallTime();
@@ -502,7 +502,7 @@
// Compute the CFM and ERP by assuming the two bodies form a
// spring-damper system.
- h = self->stepTimeP->GetValue();
+ h = (**self->stepTimeP).Double();
kp = 1.0 / (1.0 / geom1->surface->kp + 1.0 / geom2->surface->kp);
kd = geom1->surface->kd + geom2->surface->kd;
contact.surface.soft_erp = h * kp / (h * kp + kd);
Modified: code/gazebo/trunk/server/rendering/OgreCamera.cc
===================================================================
--- code/gazebo/trunk/server/rendering/OgreCamera.cc 2009-11-22 00:28:04 UTC
(rev 8432)
+++ code/gazebo/trunk/server/rendering/OgreCamera.cc 2009-11-22 20:15:37 UTC
(rev 8433)
@@ -84,7 +84,7 @@
this->camera = NULL;
- this->renderPeriod = 1.0/(**this->updateRateP);
+ this->renderPeriod = Time(1.0/(**this->updateRateP));
this->renderingEnabled = true;
}
@@ -279,8 +279,8 @@
if (!this->renderingEnabled)
return;
- double physics_dt = World::Instance()->GetPhysicsEngine()->GetStepTime();
- if
(round((Simulator::Instance()->GetSimTime()-this->lastUpdate-this->renderPeriod)/physics_dt)
>= 0)
+ Time physics_dt = World::Instance()->GetPhysicsEngine()->GetStepTime();
+ if
(((Simulator::Instance()->GetSimTime()-this->lastUpdate-this->renderPeriod)/physics_dt)
>= 0)
{
this->renderTarget->update();
@@ -668,7 +668,7 @@
char tmp[1024];
if (!this->savePathnameP->GetValue().empty())
{
- double simTime = Simulator::Instance()->GetSimTime();
+ double simTime = Simulator::Instance()->GetSimTime().Double();
int min = (int)(simTime / 60.0);
int sec = (int)(simTime - min*60);
int msec = (int)(simTime*1000 - min*60000 - sec*1000);
Modified: code/gazebo/trunk/server/rendering/OgreCamera.hh
===================================================================
--- code/gazebo/trunk/server/rendering/OgreCamera.hh 2009-11-22 00:28:04 UTC
(rev 8432)
+++ code/gazebo/trunk/server/rendering/OgreCamera.hh 2009-11-22 20:15:37 UTC
(rev 8433)
@@ -262,8 +262,8 @@
protected: bool renderingEnabled;
- protected: double renderPeriod;
- protected: double lastUpdate;
+ protected: Time renderPeriod;
+ protected: Time lastUpdate;
};
/// \}
Modified: code/gazebo/trunk/server/sensors/Sensor.cc
===================================================================
--- code/gazebo/trunk/server/sensors/Sensor.cc 2009-11-22 00:28:04 UTC (rev
8432)
+++ code/gazebo/trunk/server/sensors/Sensor.cc 2009-11-22 20:15:37 UTC (rev
8433)
@@ -80,7 +80,7 @@
this->updatePeriod = 0.0; // no throttling if updateRate is 0
else
this->updatePeriod = 1.0 / updateRate;
- this->lastUpdate = Simulator::Instance()->GetSimTime();
+ this->lastUpdate = Simulator::Instance()->GetSimTime();
}
@@ -123,10 +123,8 @@
double tmpT4 = Simulator::Instance()->GetWallTime();
#endif
-
-
- double physics_dt = World::Instance()->GetPhysicsEngine()->GetStepTime();
- if
(round((Simulator::Instance()->GetSimTime()-this->lastUpdate-this->updatePeriod)/physics_dt)
>= 0)
+ Time physics_dt = World::Instance()->GetPhysicsEngine()->GetStepTime();
+ if
(((Simulator::Instance()->GetSimTime()-this->lastUpdate-this->updatePeriod)/physics_dt)
>= 0)
{
this->UpdateChild();
this->lastUpdate = Simulator::Instance()->GetSimTime();
Modified: code/gazebo/trunk/server/sensors/Sensor.hh
===================================================================
--- code/gazebo/trunk/server/sensors/Sensor.hh 2009-11-22 00:28:04 UTC (rev
8432)
+++ code/gazebo/trunk/server/sensors/Sensor.hh 2009-11-22 20:15:37 UTC (rev
8433)
@@ -108,8 +108,8 @@
protected: bool active;
protected: ParamT<double> *updateRateP;
- protected: double updatePeriod;
- protected: double lastUpdate;
+ protected: Time updatePeriod;
+ protected: Time lastUpdate;
protected: std::string typeName;
};
/// \}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit