[Jderobot-admin] jderobot-r1225 - trunk/src/stable/components/replayer
frivas en jderobot.org
frivas en jderobot.org
Mar Abr 29 17:03:43 CEST 2014
Author: frivas
Date: 2014-04-29 17:03:42 +0200 (Tue, 29 Apr 2014)
New Revision: 1225
Modified:
trunk/src/stable/components/replayer/control.cpp
trunk/src/stable/components/replayer/control.h
trunk/src/stable/components/replayer/replayer.cpp
Log:
[#217] gettime implementation finishedo
Modified: trunk/src/stable/components/replayer/control.cpp
===================================================================
--- trunk/src/stable/components/replayer/control.cpp 2014-04-29 09:32:42 UTC (rev 1224)
+++ trunk/src/stable/components/replayer/control.cpp 2014-04-29 15:03:42 UTC (rev 1225)
@@ -38,7 +38,7 @@
return localPlay;
}
-long long int control::getTime(){
+long long int control::getSyncTime(){
long long int localTime;
this->controlMutex.lock();
localTime=this->newTime;
@@ -46,6 +46,17 @@
return localTime;
}
+long long int control::getRelativeTime(){
+ long long int localTime;
+ this->controlMutex.lock();
+ if (this->play)
+ localTime=IceUtil::Time::now().toMilliSeconds() - this->newTime;
+ else
+ localTime=this->timeToResume;
+ this->controlMutex.unlock();
+ return localTime;
+}
+
long long int control::wait(){
long long int localTime;
{
@@ -109,7 +120,6 @@
this->controlMutex.lock();
IceUtil::Time n = IceUtil::Time::now();
long long int nowInt=(n.toMicroSeconds())/1000;
- std::cout << "avanzo" << step << std::endl;
this->timeToResume=this->timeToResume + step;
this->newTime=nowInt-this->timeToResume;
this->controlMutex.unlock();
Modified: trunk/src/stable/components/replayer/control.h
===================================================================
--- trunk/src/stable/components/replayer/control.h 2014-04-29 09:32:42 UTC (rev 1224)
+++ trunk/src/stable/components/replayer/control.h 2014-04-29 15:03:42 UTC (rev 1225)
@@ -35,7 +35,8 @@
void lock();
void unlock();
bool getPlay();
- long long int getTime();
+ long long int getSyncTime(); //tiempo origen para la sincronización relativa
+ long long int getRelativeTime(); //tiempo relativo de ejecución
long long int wait();
void checkStatus();
void stop();
Modified: trunk/src/stable/components/replayer/replayer.cpp
===================================================================
--- trunk/src/stable/components/replayer/replayer.cpp 2014-04-29 09:32:42 UTC (rev 1224)
+++ trunk/src/stable/components/replayer/replayer.cpp 2014-04-29 15:03:42 UTC (rev 1225)
@@ -159,19 +159,19 @@
this->onPause=!playing;
while (!playing){
playing=controller->getPlay();
- long long int pauseStatus= controller->getTime();
+ long long int pauseStatus= controller->getSyncTime();
if (pauseStatus != this->mycamera->initState){
this->mycamera->initState=pauseStatus;
break;
}
//check if w
- std::cout << "not playing" << std::endl;
+ //std::cout << "not playing" << std::endl;
usleep(10000);
continue;
}
if (this->onPause){
- this->mycamera->initState=controller->getTime();
+ this->mycamera->initState=controller->getSyncTime();
myfile.close();
myfile.open(fileName.c_str());
}
@@ -382,7 +382,7 @@
this->onPause=!playing;
while (!playing){
playing=controller->getPlay();
- long long int pauseStatus= controller->getTime();
+ long long int pauseStatus= controller->getSyncTime();
if (pauseStatus != this->myPointCloud->initState){
this->myPointCloud->initState=pauseStatus;
break;
@@ -393,7 +393,7 @@
}
if (this->onPause){
- this->myPointCloud->initState=controller->getTime();
+ this->myPointCloud->initState=controller->getSyncTime();
myfile.close();
myfile.open(fileName.c_str());
}
@@ -521,7 +521,7 @@
this->onPause=!playing;
while (!playing){
playing=controller->getPlay();
- long long int pauseStatus= controller->getTime();
+ long long int pauseStatus= controller->getSyncTime();
if (pauseStatus != this->myLaser->initState){
this->myLaser->initState=pauseStatus;
break;
@@ -532,7 +532,7 @@
}
if (this->onPause){
- this->myLaser->initState=controller->getTime();
+ this->myLaser->initState=controller->getSyncTime();
myfile.close();
myfile.open(fileName.c_str());
}
@@ -660,7 +660,7 @@
this->onPause=!playing;
while (!playing){
playing=controller->getPlay();
- long long int pauseStatus= controller->getTime();
+ long long int pauseStatus= controller->getSyncTime();
if (pauseStatus != this->myPose3d->initState){
this->myPose3d->initState=pauseStatus;
break;
@@ -671,7 +671,7 @@
}
if (this->onPause){
- this->myPose3d->initState=controller->getTime();
+ this->myPose3d->initState=controller->getSyncTime();
myfile.close();
myfile.open(fileName.c_str());
}
@@ -824,7 +824,7 @@
this->onPause=!playing;
while (!playing){
playing=controller->getPlay();
- long long int pauseStatus= controller->getTime();
+ long long int pauseStatus= controller->getSyncTime();
if (pauseStatus != this->myEncoder->initState){
this->myEncoder->initState=pauseStatus;
break;
@@ -835,7 +835,7 @@
}
if (this->onPause){
- this->myEncoder->initState=controller->getTime();
+ this->myEncoder->initState=controller->getSyncTime();
myfile.close();
myfile.open(fileName.c_str());
}
@@ -963,8 +963,7 @@
return true;
}
virtual Ice::Long getTime(const Ice::Current&){
- //return the rurrent time
- return 0;
+ return controller->getRelativeTime();
}
virtual bool goTo(Ice::Long seek, const Ice::Current&){
//set the current position to seek
@@ -1237,7 +1236,6 @@
while (1){
//gui->update();
replayer::controller->checkStatus();
- usleep(50000);
}
More information about the Jderobot-admin
mailing list