[Jderobot-admin] jderobot-r1179 - trunk/src/stable/libs/parallelIce
rocapal en jderobot.org
rocapal en jderobot.org
Lun Mar 3 19:53:35 CET 2014
Author: rocapal
Date: 2014-03-03 19:53:35 +0100 (Mon, 03 Mar 2014)
New Revision: 1179
Modified:
trunk/src/stable/libs/parallelIce/cameraClient.cpp
trunk/src/stable/libs/parallelIce/pointcloudClient.cpp
Log:
#145 fixed bug about sleep
Modified: trunk/src/stable/libs/parallelIce/cameraClient.cpp
===================================================================
--- trunk/src/stable/libs/parallelIce/cameraClient.cpp 2014-03-03 18:46:28 UTC (rev 1178)
+++ trunk/src/stable/libs/parallelIce/cameraClient.cpp 2014-03-03 18:53:35 UTC (rev 1179)
@@ -113,21 +113,21 @@
localData.copyTo(this->data);
this->controlMutex.unlock();
- int delay = this->cycle - (IceUtil::Time::now().toMicroSeconds() - last.toMicroSeconds());
+ int process = this->cycle - (IceUtil::Time::now().toMicroSeconds() - last.toMicroSeconds());
- if (delay > this->cycle ){
- if (this->debug)
+ if (process > (int)cycle ){
+ if (debug==3)
std::cout<<"--------" << prefix << " adquisition timeout-" << std::endl;
}
else{
-
- if (delay < 1 || delay > this->cycle)
+ int delay = (int)cycle - process;
+ if (delay <1 || delay > (int)cycle)
delay = 1;
usleep(delay);
-
}
+
int rate =(int)(1000000/(IceUtil::Time::now().toMicroSeconds() - last.toMicroSeconds()));
totalRefreshRate = totalRefreshRate + rate;
this->refreshRate= totalRefreshRate / iterIndex;
Modified: trunk/src/stable/libs/parallelIce/pointcloudClient.cpp
===================================================================
--- trunk/src/stable/libs/parallelIce/pointcloudClient.cpp 2014-03-03 18:46:28 UTC (rev 1178)
+++ trunk/src/stable/libs/parallelIce/pointcloudClient.cpp 2014-03-03 18:53:35 UTC (rev 1179)
@@ -90,13 +90,23 @@
std::copy( localCloud->p.begin(), localCloud->p.end(), this->data.begin() );
this->controlMutex.unlock();
- if ((IceUtil::Time::now().toMicroSeconds() - last.toMicroSeconds()) > this->cycle ){
- if (this->debug)
- std::cout<< prefix << ": pointCloud adquisition timeout-" << std::endl;
+
+
+ int process = this->cycle - (IceUtil::Time::now().toMicroSeconds() - last.toMicroSeconds());
+
+ if (process > (int)cycle ){
+ if (debug==3)
+ std::cout<<"--------" << prefix << ": pointCloud adquisition timeout-" << std::endl;
}
else{
- usleep(this->cycle - (IceUtil::Time::now().toMicroSeconds() - last.toMicroSeconds()));
+ int delay = (int)cycle - process;
+ if (delay <1 || delay > (int)cycle)
+ delay = 1;
+
+ usleep(delay);
}
+
+
this->refreshRate=(int)(1000000/(IceUtil::Time::now().toMicroSeconds() - last.toMicroSeconds()));
last=IceUtil::Time::now();
}
More information about the Jderobot-admin
mailing list