[Jderobot-admin] jderobot-r1244 - trunk/src/stable/libs/parallelIce
frivas en jderobot.org
frivas en jderobot.org
Mar Oct 28 17:08:19 CET 2014
Author: frivas
Date: 2014-10-28 17:08:19 +0100 (Tue, 28 Oct 2014)
New Revision: 1244
Modified:
trunk/src/stable/libs/parallelIce/cameraClient.cpp
trunk/src/stable/libs/parallelIce/laserClient.cpp
trunk/src/stable/libs/parallelIce/pointcloudClient.cpp
Log:
#284 Included Ice exception handler in parallelIce
Modified: trunk/src/stable/libs/parallelIce/cameraClient.cpp
===================================================================
--- trunk/src/stable/libs/parallelIce/cameraClient.cpp 2014-10-28 15:38:05 UTC (rev 1243)
+++ trunk/src/stable/libs/parallelIce/cameraClient.cpp 2014-10-28 16:08:19 UTC (rev 1244)
@@ -136,16 +136,24 @@
this->sem.wait(sync);
}
- dataPtr = this->prx->getImageData();
- fmt = colorspaces::Image::Format::searchFormat(dataPtr->description->format);
- if (!fmt)
- throw "Format not supported";
- colorspaces::Image imageRGB(dataPtr->description->width,dataPtr->description->height,fmt,&(dataPtr->pixelData[0]));
- colorspaces::ImageRGB8 img_rgb888(imageRGB);//conversion will happen if needed
- this->controlMutex.lock();
- cv::Mat(cvSize(img_rgb888.width,img_rgb888.height), CV_8UC3, img_rgb888.data).copyTo(this->data);
- this->controlMutex.unlock();
- img_rgb888.release();
+ try{
+ dataPtr = this->prx->getImageData();
+ fmt = colorspaces::Image::Format::searchFormat(dataPtr->description->format);
+ if (!fmt)
+ throw "Format not supported";
+ colorspaces::Image imageRGB(dataPtr->description->width,dataPtr->description->height,fmt,&(dataPtr->pixelData[0]));
+ colorspaces::ImageRGB8 img_rgb888(imageRGB);//conversion will happen if needed
+ this->controlMutex.lock();
+ cv::Mat(cvSize(img_rgb888.width,img_rgb888.height), CV_8UC3, img_rgb888.data).copyTo(this->data);
+ this->controlMutex.unlock();
+ img_rgb888.release();
+ }
+ catch(...){
+ jderobot::Logger::getInstance()->warning(prefix +"error during request (connection error)");
+ usleep(5000);
+
+ }
+
int process = this->cycle - (IceUtil::Time::now().toMicroSeconds() - last.toMicroSeconds());
if (process > (int)cycle ){
Modified: trunk/src/stable/libs/parallelIce/laserClient.cpp
===================================================================
--- trunk/src/stable/libs/parallelIce/laserClient.cpp 2014-10-28 15:38:05 UTC (rev 1243)
+++ trunk/src/stable/libs/parallelIce/laserClient.cpp 2014-10-28 16:08:19 UTC (rev 1244)
@@ -83,14 +83,22 @@
this->sem.wait(sync);
}
- jderobot::LaserDataPtr localLaser=this->prx->getLaserData();
+ try{
+ jderobot::LaserDataPtr localLaser=this->prx->getLaserData();
- this->controlMutex.lock();
- this->data.resize(localLaser->distanceData.size());
- std::copy( localLaser->distanceData.begin(), localLaser->distanceData.end(), this->data.begin() );
+ this->controlMutex.lock();
+ this->data.resize(localLaser->distanceData.size());
+ std::copy( localLaser->distanceData.begin(), localLaser->distanceData.end(), this->data.begin() );
- this->controlMutex.unlock();
+ this->controlMutex.unlock();
+ }
+ catch(...){
+ jderobot::Logger::getInstance()->warning(prefix +"error during request (connection error)");
+ usleep(5000);
+ }
+
+
if ((IceUtil::Time::now().toMicroSeconds() - last.toMicroSeconds()) > this->cycle ){
jderobot::Logger::getInstance()->warning(prefix + ": pointCloud adquisition timeout-");
}
Modified: trunk/src/stable/libs/parallelIce/pointcloudClient.cpp
===================================================================
--- trunk/src/stable/libs/parallelIce/pointcloudClient.cpp 2014-10-28 15:38:05 UTC (rev 1243)
+++ trunk/src/stable/libs/parallelIce/pointcloudClient.cpp 2014-10-28 16:08:19 UTC (rev 1244)
@@ -40,14 +40,15 @@
this->prx = jderobot::pointCloudPrx::checkedCast(basePointCloud);
if (0==this->prx)
throw "Invalid proxy" + prefix;
-
}
}catch (const Ice::Exception& ex) {
std::cerr << ex << std::endl;
+ throw "Invalid proxy" + prefix;
}
catch (const char* msg) {
std::cerr << msg << std::endl;
jderobot::Logger::getInstance()->error(prefix + " Not camera provided");
+ throw "Invalid proxy" + prefix;
}
_done=false;
this->pauseStatus=false;
@@ -76,10 +77,12 @@
}
}catch (const Ice::Exception& ex) {
std::cerr << ex << std::endl;
+ throw "Invalid proxy" + prefix;
}
catch (const char* msg) {
std::cerr << msg << std::endl;
jderobot::Logger::getInstance()->error(prefix + " Not camera provided");
+ throw "Invalid proxy" + prefix;
}
_done=false;
this->pauseStatus=false;
@@ -117,15 +120,22 @@
this->sem.wait(sync);
}
- jderobot::pointCloudDataPtr localCloud=this->prx->getCloudData();
+ try{
+ jderobot::pointCloudDataPtr localCloud=this->prx->getCloudData();
+ this->controlMutex.lock();
+ this->data.resize(localCloud->p.size());
+ std::copy( localCloud->p.begin(), localCloud->p.end(), this->data.begin() );
+ this->controlMutex.unlock();
+ }
+ catch(...){
+ jderobot::Logger::getInstance()->warning(prefix +"error during request (connection error)");
+ usleep(5000);
- this->controlMutex.lock();
- this->data.resize(localCloud->p.size());
- std::copy( localCloud->p.begin(), localCloud->p.end(), this->data.begin() );
+ }
- this->controlMutex.unlock();
+
int process = this->cycle - (IceUtil::Time::now().toMicroSeconds() - last.toMicroSeconds());
if (process > (int)cycle ){
More information about the Jderobot-admin
mailing list