Revision: 7763
http://playerstage.svn.sourceforge.net/playerstage/?rev=7763&view=rev
Author: hsujohnhsu
Date: 2009-06-03 00:57:10 +0000 (Wed, 03 Jun 2009)
Log Message:
-----------
- fix time scaling.
- output instantaneous speedup rates.
Modified Paths:
--------------
code/gazebo/trunk/server/gui/StatusBar.cc
code/gazebo/trunk/server/gui/StatusBar.hh
Modified: code/gazebo/trunk/server/gui/StatusBar.cc
===================================================================
--- code/gazebo/trunk/server/gui/StatusBar.cc 2009-06-03 00:56:24 UTC (rev
7762)
+++ code/gazebo/trunk/server/gui/StatusBar.cc 2009-06-03 00:57:10 UTC (rev
7763)
@@ -110,24 +110,42 @@
void StatusBar::Update()
{
float avgFPS = 0;
- float percent = 0;
+ //float percent = 0;
float sim = 0;
float real = 0;
- if (Simulator::Instance()->GetRealTime() - this->lastUpdateTime > 0.05)
+ if (Simulator::Instance()->GetRealTime() - this->lastUpdateTime >
this->statusUpdatePeriod)
{
avgFPS = this->gui->GetAvgFPS();
- percent = (Simulator::Instance()->GetSimTime() /
Simulator::Instance()->GetRealTime());
+ if (Simulator::Instance()->GetRealTime() < this->statusUpdatePeriod )
+ {
+ this->percent = (Simulator::Instance()->GetSimTime() /
Simulator::Instance()->GetRealTime());
+ this->percentLastRealTime =0;
+ this->percentLastSimTime = 0;
+ }
+ else
+ {
+ this->percent =
((Simulator::Instance()->GetSimTime()-this->percentLastSimTime)
+ /
(Simulator::Instance()->GetRealTime()-this->percentLastRealTime) );
+ this->percentLastRealTime =Simulator::Instance()->GetRealTime();
+ this->percentLastSimTime = Simulator::Instance()->GetSimTime();
+ }
+
sim = Simulator::Instance()->GetSimTime();
- if (sim > 99999)
+ if (sim > 31536000)
{
- sim /= (120*24);
+ sim /= (31536000);
this->simTime->label("(dys) Sim Time");
}
- else if (sim > 9999)
+ else if (sim > 86400)
{
- sim /= 120;
+ sim /= (86400);
+ this->simTime->label("(dys) Sim Time");
+ }
+ else if (sim > 3600)
+ {
+ sim /= 3600;
this->simTime->label("(hrs) Sim Time");
}
else if (sim > 999)
@@ -137,14 +155,19 @@
}
real = Simulator::Instance()->GetRealTime();
- if (sim > 99999)
+ if (sim > 31536000)
{
- real /= (120*24);
+ real /= (31536000);
this->realTime->label("(dys) Real Time");
}
- else if (real > 9999)
+ else if (sim > 86400)
{
- real /= 120;
+ real /= (86400);
+ this->realTime->label("(dys) Real Time");
+ }
+ else if (real > 3600)
+ {
+ real /= 3600;
this->realTime->label("(hrs) Real Time");
}
else if (real > 999)
@@ -155,7 +178,7 @@
//this->iterations->value(Simulator::Instance()->GetIterations());
this->fps->value(avgFPS);
- this->percentOutput->value(percent);
+ this->percentOutput->value(this->percent);
//if (Simulator::Instance()->GetRealTime() - this->realTime->value() > 0.1)
Modified: code/gazebo/trunk/server/gui/StatusBar.hh
===================================================================
--- code/gazebo/trunk/server/gui/StatusBar.hh 2009-06-03 00:56:24 UTC (rev
7762)
+++ code/gazebo/trunk/server/gui/StatusBar.hh 2009-06-03 00:57:10 UTC (rev
7763)
@@ -66,6 +66,10 @@
public: Gui *gui;
private: double lastUpdateTime;
+
+ // calculated percent speedup in last percentWindowDuration seconds real
time.
+ private: double percent, percentLastRealTime, percentLastSimTime;
+ private: static const double statusUpdatePeriod = 0.05;
};
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
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-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit