[Jderobot-admin] jderobot-r923 - in trunk: . src/components/calibratorKinect src/components/kinectViewer src/components/replayController src/libs src/libs/jderobotice

frivas en jderobot.org frivas en jderobot.org
Jue Mayo 30 16:49:41 CEST 2013


Author: frivas
Date: 2013-05-30 16:48:41 +0200 (Thu, 30 May 2013)
New Revision: 923

Added:
   trunk/src/libs/jderobotice/cameraClient.cpp
   trunk/src/libs/jderobotice/cameraClient.h
   trunk/src/libs/jderobotice/pointcloudClient.cpp
   trunk/src/libs/jderobotice/pointcloudClient.h
Removed:
   trunk/src/libs/parallelIce/
Modified:
   trunk/CMakeLists.txt
   trunk/src/components/calibratorKinect/CMakeLists.txt
   trunk/src/components/calibratorKinect/common.h
   trunk/src/components/kinectViewer/CMakeLists.txt
   trunk/src/components/kinectViewer/kinectViewer.cpp
   trunk/src/components/replayController/CMakeLists.txt
   trunk/src/libs/jderobotice/CMakeLists.txt
Log:
modificados los componentes de parallelIce con los logs adecuados, y a?\195?\177adido dentro de la librer?\195?\173a jderobotice


Modified: trunk/CMakeLists.txt
===================================================================
--- trunk/CMakeLists.txt	2013-05-28 05:57:43 UTC (rev 922)
+++ trunk/CMakeLists.txt	2013-05-30 14:48:41 UTC (rev 923)
@@ -8,7 +8,7 @@
 SET( INTERFACES_CPP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/interfaces/cpp) # Directorio con las interfaces ICE en C++
 SET( LIBS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/libs) # Directorio donde se encuentran las librerias propias de jderobot
 SET( SLICE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/interfaces/slice) # Directorio donde se encuentran las interfaces ICE
-SET( LIBS_NEEDED   bgfgsegmentation jderobotice colorspaces jderobotutil progeo pioneer fuzzylib visionlib parallelIce ) # Librerias de las que depende el componente
+SET( LIBS_NEEDED   bgfgsegmentation colorspaces jderobotice jderobotutil progeo pioneer fuzzylib visionlib ) # Librerias de las que depende el componente
 
 SET( DEPS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Deps) # Directorio donde se encuentran las dependencias
 SET( COMPONENTS calibrator  calibratorKinect openniServer-kinect naooperator         basic_component		         

Modified: trunk/src/components/calibratorKinect/CMakeLists.txt
===================================================================
--- trunk/src/components/calibratorKinect/CMakeLists.txt	2013-05-28 05:57:43 UTC (rev 922)
+++ trunk/src/components/calibratorKinect/CMakeLists.txt	2013-05-30 14:48:41 UTC (rev 923)
@@ -28,6 +28,6 @@
  ${LIBS_DIR}/colorspaces/libcolorspacesmm.so
  ${INTERFACES_CPP_DIR}/jderobot/libJderobotInterfaces.so
  ${LIBS_DIR}/progeo/libprogeo.so
- ${LIBS_DIR}/parallelIce/libparallelIce.so
+ ${LIBS_DIR}/jderobotice/libparallelIce.so
     #-lxerces-c
 )

Modified: trunk/src/components/calibratorKinect/common.h
===================================================================
--- trunk/src/components/calibratorKinect/common.h	2013-05-28 05:57:43 UTC (rev 922)
+++ trunk/src/components/calibratorKinect/common.h	2013-05-30 14:48:41 UTC (rev 923)
@@ -19,7 +19,7 @@
  *             Jose María Cañas Plaza <jmplaza en gsyc.es>
  *
  */
-#include <parallelIce/cameraClient.h>
+#include <jderobotice/cameraClient.h>
 
 #ifndef calibrator_COMMON_H
 #define calibrator_COMMON_H

Modified: trunk/src/components/kinectViewer/CMakeLists.txt
===================================================================
--- trunk/src/components/kinectViewer/CMakeLists.txt	2013-05-28 05:57:43 UTC (rev 922)
+++ trunk/src/components/kinectViewer/CMakeLists.txt	2013-05-30 14:48:41 UTC (rev 923)
@@ -26,6 +26,6 @@
     ${LIBS_DIR}/jderobotutil/libjderobotutil.so
     ${LIBS_DIR}/progeo/libprogeo.so
     ${LIBS_DIR}/pioneer/libpioneer.so
-    ${LIBS_DIR}/parallelIce/libparallelIce.so
+    ${LIBS_DIR}/jderobotice/libparallelIce.so
     ${ZeroCIce_LIBRARIES}
 )

Modified: trunk/src/components/kinectViewer/kinectViewer.cpp
===================================================================
--- trunk/src/components/kinectViewer/kinectViewer.cpp	2013-05-28 05:57:43 UTC (rev 922)
+++ trunk/src/components/kinectViewer/kinectViewer.cpp	2013-05-30 14:48:41 UTC (rev 923)
@@ -29,8 +29,8 @@
 #include <jderobot/pointcloud.h>
 #include "kinectViewergui.h"
 #include "pthread.h"
-#include "parallelIce/cameraClient.h"
-#include "parallelIce/pointcloudClient.h"
+#include "jderobotice/cameraClient.h"
+#include "jderobotice/pointcloudClient.h"
 
 
 

Modified: trunk/src/components/replayController/CMakeLists.txt
===================================================================
--- trunk/src/components/replayController/CMakeLists.txt	2013-05-28 05:57:43 UTC (rev 922)
+++ trunk/src/components/replayController/CMakeLists.txt	2013-05-30 14:48:41 UTC (rev 923)
@@ -29,6 +29,5 @@
     ${LIBS_DIR}/jderobotutil/libjderobotutil.so
     ${LIBS_DIR}/progeo/libprogeo.so
     ${LIBS_DIR}/pioneer/libpioneer.so
-    ${LIBS_DIR}/parallelIce/libparallelIce.so
     ${ZeroCIce_LIBRARIES}
 )

Modified: trunk/src/libs/jderobotice/CMakeLists.txt
===================================================================
--- trunk/src/libs/jderobotice/CMakeLists.txt	2013-05-28 05:57:43 UTC (rev 922)
+++ trunk/src/libs/jderobotice/CMakeLists.txt	2013-05-30 14:48:41 UTC (rev 923)
@@ -14,3 +14,28 @@
 
 
 set_target_properties(jderoboticeshare PROPERTIES OUTPUT_NAME jderobotice)
+
+include_directories(
+    ${INTERFACES_CPP_DIR}
+    ${LIBS_DIR}/
+    ${CMAKE_CURRENT_SOURCE_DIR}
+    ${CMAKE_CURRENT_SOURCE_DIR}/cameras
+)
+
+add_library (parallelIce STATIC cameraClient.cpp  cameraClient.h  pointcloudClient.cpp  pointcloudClient.h)
+TARGET_LINK_LIBRARIES(parallelIce 
+   	${OpenCV_LIBRARIES}
+    ${LIBS_DIR}/colorspaces/libcolorspacesmm.so
+    ${ZeroCIce_LIBRARIES}
+)
+
+add_library (parallelIceshare SHARED cameraClient.cpp  cameraClient.h  pointcloudClient.cpp  pointcloudClient.h)
+TARGET_LINK_LIBRARIES(parallelIceshare 
+   	${OpenCV_LIBRARIES}
+    ${LIBS_DIR}/colorspaces/libcolorspacesmm.so
+    ${ZeroCIce_LIBRARIES}
+)
+
+
+set_target_properties(parallelIceshare PROPERTIES OUTPUT_NAME parallelIce)
+

Copied: trunk/src/libs/jderobotice/cameraClient.cpp (from rev 919, trunk/src/libs/parallelIce/cameraClient.cpp)
===================================================================
--- trunk/src/libs/jderobotice/cameraClient.cpp	                        (rev 0)
+++ trunk/src/libs/jderobotice/cameraClient.cpp	2013-05-30 14:48:41 UTC (rev 923)
@@ -0,0 +1,106 @@
+/*
+ *  Copyright (C) 1997-2013 JDE Developers TeamkinectViewer.camRGB
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see http://www.gnu.org/licenses/.
+ *
+ *  Author : Jose María Cañas <jmplaza en gsyc.es>
+			Francisco Miguel Rivas Montero <franciscomiguel.rivas en urjc.es>
+
+ */
+
+#include "cameraClient.h"
+
+
+namespace jderobot {
+
+cameraClient::cameraClient(Ice::CommunicatorPtr ic, std::string prefix) {
+	// TODO Auto-generated constructor stubcameraClient* client = new cameraClient;
+	this->prefix=prefix;
+	Ice::PropertiesPtr prop;
+	prop = ic->getProperties();
+	Ice::ObjectPrx baseCamera;
+
+
+	int fps=prop->getPropertyAsIntWithDefault(prefix+"Fps",10);
+	this->cycle=(float)(1/(float)fps)*1000000;
+	try{
+		baseCamera = ic->propertyToProxy(prefix+"Proxy");
+		if (0==baseCamera){
+			throw prefix + "Could not create proxy with Camera";
+		}
+		else {
+			this->prx= jderobot::CameraPrx::checkedCast(baseCamera);
+			if (0==this->prx)
+				throw "Invalid " + prefix + ".Proxy";
+		}
+	}catch (const Ice::Exception& ex) {
+		std::cerr << ex << std::endl;
+	}
+	catch (const char* msg) {
+		std::cerr << msg << std::endl;
+		std::cout << prefix + " Not camera provided" << std::endl;
+	}
+}
+
+cameraClient::~cameraClient() {
+	// TODO Auto-generated destructor stub
+}
+
+void
+cameraClient::run(){
+	jderobot::ImageDataPtr dataPtr;
+	colorspaces::Image::FormatPtr fmt;
+	struct timeval post;
+	long long int totalpre=0;
+	long long int totalpost=0;
+	while (this->isAlive()){
+		gettimeofday(&post,NULL);
+		totalpost=post.tv_sec*1000000+post.tv_usec;
+
+		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
+		cv::Mat localDataPtr = cv::Mat(cvSize(img_rgb888.width,img_rgb888.height), CV_8UC3, img_rgb888.data);
+		cv::Mat localData;
+		localDataPtr.copyTo(localData);
+		this->controlMutex.lock();
+		this->data.release();
+		localData.copyTo(this->data);
+		this->controlMutex.unlock();
+
+		if (totalpre !=0){
+			if ((totalpost - totalpre) > this->cycle ){
+				std::cout<<"--------" << prefix << " adquisition timeout-" << std::endl;
+			}
+			else{
+				usleep(this->cycle - (totalpost - totalpre));
+			}
+		}
+		totalpre=totalpost;
+	}
+}
+
+cv::Mat cameraClient::getImage(){
+	cv::Mat local;
+	this->controlMutex.lock();
+	this->data.copyTo(local);
+	this->controlMutex.unlock();
+	return local;
+
+}
+
+} /* namespace jderobot */

Copied: trunk/src/libs/jderobotice/cameraClient.h (from rev 919, trunk/src/libs/parallelIce/cameraClient.h)
===================================================================
--- trunk/src/libs/jderobotice/cameraClient.h	                        (rev 0)
+++ trunk/src/libs/jderobotice/cameraClient.h	2013-05-30 14:48:41 UTC (rev 923)
@@ -0,0 +1,56 @@
+/*
+ *  Copyright (C) 1997-2013 JDE Developers TeamkinectViewer.camRGB
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see http://www.gnu.org/licenses/.
+ *
+ *  Author : Jose María Cañas <jmplaza en gsyc.es>
+			Francisco Miguel Rivas Montero <franciscomiguel.rivas en urjc.es>
+
+ */
+
+#ifndef CAMERACLIENT_H_
+#define CAMERACLIENT_H_
+
+#include <IceUtil/IceUtil.h>
+#include <iostream>
+#include <Ice/Ice.h>
+#include <colorspaces/colorspacesmm.h>
+#include <jderobot/camera.h>
+#include <cv.h>
+#include <sstream>
+#include <fstream>
+
+
+namespace jderobot {
+
+class cameraClient: public IceUtil::Thread {
+public:
+	cameraClient(Ice::CommunicatorPtr ic, std::string prefix);
+	virtual ~cameraClient();
+	virtual void run();
+
+	//callbacks
+	cv::Mat getImage();
+private:
+	cv::Mat data;
+	jderobot::CameraPrx prx;
+	long long int cycle;
+	//int type; //0 color 1 depth
+	IceUtil::Mutex controlMutex;
+	std::string prefix;
+
+};
+
+} /* namespace jderobot */
+#endif /* CAMERACLIENT_H_ */

Copied: trunk/src/libs/jderobotice/pointcloudClient.cpp (from rev 919, trunk/src/libs/parallelIce/pointcloudClient.cpp)
===================================================================
--- trunk/src/libs/jderobotice/pointcloudClient.cpp	                        (rev 0)
+++ trunk/src/libs/jderobotice/pointcloudClient.cpp	2013-05-30 14:48:41 UTC (rev 923)
@@ -0,0 +1,96 @@
+/*
+ *  Copyright (C) 1997-2013 JDE Developers TeamkinectViewer.camRGB
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see http://www.gnu.org/licenses/.
+ *
+ *  Author : Jose María Cañas <jmplaza en gsyc.es>
+			Francisco Miguel Rivas Montero <franciscomiguel.rivas en urjc.es>
+
+ */
+#include "pointcloudClient.h"
+
+namespace jderobot {
+
+pointcloudClient::pointcloudClient(Ice::CommunicatorPtr ic, std::string prefix) {
+	// TODO Auto-generated constructor stub
+	this->prefix=prefix;
+
+	Ice::PropertiesPtr prop;
+	prop = ic->getProperties();
+
+	int fps=prop->getPropertyAsIntWithDefault(prefix+"Fps",10);
+	this->cycle=(float)(1/(float)fps)*1000000;
+	try{
+		Ice::ObjectPrx basePointCloud = ic->propertyToProxy(prefix+"Proxy");
+		if (0==basePointCloud){
+			throw prefix + " Could not create proxy";
+		}
+		else {
+			this->prx = jderobot::pointCloudPrx::checkedCast(basePointCloud);
+			if (0==this->prx)
+				throw "Invalid proxy" + prefix;
+
+		}
+	}catch (const Ice::Exception& ex) {
+		std::cerr << ex << std::endl;
+	}
+	catch (const char* msg) {
+		std::cerr << msg << std::endl;
+		std::cout <<  prefix + " Not camera provided" << std::endl;
+	}
+
+}
+
+pointcloudClient::~pointcloudClient() {
+	// TODO Auto-generated destructor stub
+}
+
+void pointcloudClient::run(){
+
+	struct timeval post;
+	long long int totalpre=0;
+	long long int totalpost=0;
+	while (1){
+		gettimeofday(&post,NULL);
+		totalpost=post.tv_sec*1000000+post.tv_usec;
+
+		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();
+		if (totalpre !=0){
+			if ((totalpost - totalpre) > this->cycle ){
+				std::cout<< prefix << ": pointCloud adquisition timeout-" << std::endl;
+			}
+			else{
+				usleep(this->cycle - (totalpost - totalpre));
+			}
+		}
+		totalpre=totalpost;
+	}
+}
+
+std::vector<jderobot::RGBPoint>  pointcloudClient::getData(){
+	std::vector<jderobot::RGBPoint> cloud;
+	this->controlMutex.lock();
+	cloud.resize(this->data.size());
+	std::copy( this->data.begin(), this->data.end(), cloud.begin() );
+	this->controlMutex.unlock();
+	return cloud;
+}
+
+} /* namespace jderobot */

Copied: trunk/src/libs/jderobotice/pointcloudClient.h (from rev 919, trunk/src/libs/parallelIce/pointcloudClient.h)
===================================================================
--- trunk/src/libs/jderobotice/pointcloudClient.h	                        (rev 0)
+++ trunk/src/libs/jderobotice/pointcloudClient.h	2013-05-30 14:48:41 UTC (rev 923)
@@ -0,0 +1,55 @@
+/*
+ *  Copyright (C) 1997-2013 JDE Developers TeamkinectViewer.camRGB
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see http://www.gnu.org/licenses/.
+ *
+ *  Author : Jose María Cañas <jmplaza en gsyc.es>
+			Francisco Miguel Rivas Montero <franciscomiguel.rivas en urjc.es>
+
+ */
+
+
+#ifndef POINTCLOUDCLIENT_H_
+#define POINTCLOUDCLIENT_H_
+
+#include <IceUtil/IceUtil.h>
+#include <iostream>
+#include <Ice/Ice.h>
+#include <jderobot/pointcloud.h>
+#include <cv.h>
+#include <sstream>
+#include <fstream>
+
+namespace jderobot {
+
+class pointcloudClient: public IceUtil::Thread {
+public:
+	pointcloudClient(Ice::CommunicatorPtr ic, std::string prefix);
+	virtual ~pointcloudClient();
+	virtual void run();
+
+	std::vector<jderobot::RGBPoint>  getData();
+
+
+private:
+	std::string prefix;
+	std::vector<jderobot::RGBPoint> data;
+	jderobot::pointCloudPrx prx;
+	long long int cycle;
+	IceUtil::Mutex controlMutex;
+
+};
+
+} /* namespace jderobot */
+#endif /* POINTCLOUDCLIENT_H_ */



More information about the Jderobot-admin mailing list