Revision: 7478
http://playerstage.svn.sourceforge.net/playerstage/?rev=7478&view=rev
Author: natepak
Date: 2009-03-13 20:42:17 +0000 (Fri, 13 Mar 2009)
Log Message:
-----------
Fixed up the status bar a little
Modified Paths:
--------------
code/branches/federation/gazebo/server/Simulator.cc
code/branches/federation/gazebo/server/gui/StatusBar.cc
code/branches/federation/gazebo/server/gui/StatusBar.hh
code/branches/federation/gazebo/server/rendering/OgreCreator.cc
Modified: code/branches/federation/gazebo/server/Simulator.cc
===================================================================
--- code/branches/federation/gazebo/server/Simulator.cc 2009-03-13 18:52:33 UTC
(rev 7477)
+++ code/branches/federation/gazebo/server/Simulator.cc 2009-03-13 20:42:17 UTC
(rev 7478)
@@ -541,7 +541,7 @@
{
-// boost::recursive_mutex::scoped_lock lock(*this->mutex);
+ boost::recursive_mutex::scoped_lock lock(*this->mutex);
world->Update();
}
}
Modified: code/branches/federation/gazebo/server/gui/StatusBar.cc
===================================================================
--- code/branches/federation/gazebo/server/gui/StatusBar.cc 2009-03-13
18:52:33 UTC (rev 7477)
+++ code/branches/federation/gazebo/server/gui/StatusBar.cc 2009-03-13
20:42:17 UTC (rev 7478)
@@ -51,11 +51,11 @@
this->percent = new Fl_Value_Output(x,y,65,20,"% Real Time");
this->percent->precision(2);
- x = this->percent->x() + this->percent->w() + 80;
+ x = this->percent->x() + this->percent->w() + 120;
this->realTime = new Fl_Value_Output(x,y,55,20,"Real Time (sec)");
this->realTime->precision(2);
- x = this->realTime->x() + this->realTime->w() + 85;
+ x = this->realTime->x() + this->realTime->w() + 120;
this->simTime = new Fl_Value_Output(x,y,65,20,"Sim Time (sec)");
this->simTime->precision(2);
@@ -63,7 +63,7 @@
this->pauseTime = new Fl_Value_Output(x,y,55,20,"Pause Time");
this->pauseTime->precision(2);
- x = this->pauseTime->x() + this->pauseTime->w() + 30;
+ x = this->pauseTime->x() + this->pauseTime->w() + 20;
this->playButton = new Fl_Button(x, y, 30, 20, "@||");
this->playButton->callback( &gazebo::StatusBar::PlayPauseButtonCB, this );
@@ -76,6 +76,7 @@
this->end();
this->show();
+ this->lastUpdateTime = 0;
}
StatusBar::~StatusBar()
@@ -90,27 +91,42 @@
float percent = 0;
float sim = 0;
- avgFPS = this->gui->GetAvgFPS();
- percent = 100. * (Simulator::Instance()->GetSimTime() /
Simulator::Instance()->GetRealTime());
-
- sim = Simulator::Instance()->GetSimTime();
- if (sim > 9999)
+ if (Simulator::Instance()->GetRealTime() - this->lastUpdateTime > 0.05)
{
- sim /= 60;
- this->simTime->label("Sim Time (min)");
- }
+ avgFPS = this->gui->GetAvgFPS();
+ percent = 100. * (Simulator::Instance()->GetSimTime() /
Simulator::Instance()->GetRealTime());
- //this->iterations->value(Simulator::Instance()->GetIterations());
- this->fps->value(avgFPS);
- this->percent->value(percent);
+ sim = Simulator::Instance()->GetSimTime();
+ if (sim > 99999)
+ {
+ sim /= (120*24);
+ this->simTime->label("Sim Time (dys)");
+ }
+ else if (sim > 9999)
+ {
+ sim /= 120;
+ this->simTime->label("Sim Time (hrs)");
+ }
+ else if (sim > 999)
+ {
+ sim /= 60;
+ this->simTime->label("Sim Time (min)");
+ }
- if (Simulator::Instance()->GetRealTime() - this->realTime->value() > 0.1)
- {
- this->realTime->value(Simulator::Instance()->GetRealTime());
+ //this->iterations->value(Simulator::Instance()->GetIterations());
+ this->fps->value(avgFPS);
+ this->percent->value(percent);
+
+ if (Simulator::Instance()->GetRealTime() - this->realTime->value() > 0.1)
+ {
+ this->realTime->value(Simulator::Instance()->GetRealTime());
+ }
+
+ this->simTime->value(sim);
+ this->pauseTime->value(Simulator::Instance()->GetPauseTime());
+
+ this->lastUpdateTime = Simulator::Instance()->GetRealTime();
}
-
- this->simTime->value();
- this->pauseTime->value(Simulator::Instance()->GetPauseTime());
}
////////////////////////////////////////////////////////////////////////////////
Modified: code/branches/federation/gazebo/server/gui/StatusBar.hh
===================================================================
--- code/branches/federation/gazebo/server/gui/StatusBar.hh 2009-03-13
18:52:33 UTC (rev 7477)
+++ code/branches/federation/gazebo/server/gui/StatusBar.hh 2009-03-13
20:42:17 UTC (rev 7478)
@@ -64,6 +64,8 @@
private: Fl_Button *stepButton;
public: Gui *gui;
+
+ private: double lastUpdateTime;
};
}
Modified: code/branches/federation/gazebo/server/rendering/OgreCreator.cc
===================================================================
--- code/branches/federation/gazebo/server/rendering/OgreCreator.cc
2009-03-13 18:52:33 UTC (rev 7477)
+++ code/branches/federation/gazebo/server/rendering/OgreCreator.cc
2009-03-13 20:42:17 UTC (rev 7478)
@@ -691,8 +691,7 @@
}
{
-
- //boost::recursive_mutex::scoped_lock
lock(*Simulator::Instance()->GetMutex());
+ boost::recursive_mutex::scoped_lock
lock(*Simulator::Instance()->GetMutex());
// Update the visuals
for (viter = this->visuals.begin(); viter != this->visuals.end(); viter++)
{
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit