[Jderobot-admin] jderobot-r1193 - trunk/src/stable/components/openniServer
rocapal en jderobot.org
rocapal en jderobot.org
Lun Mar 17 11:16:19 CET 2014
Author: rocapal
Date: 2014-03-17 11:16:19 +0100 (Mon, 17 Mar 2014)
New Revision: 1193
Modified:
trunk/src/stable/components/openniServer/CMakeLists.txt
trunk/src/stable/components/openniServer/openniServer.cfg
trunk/src/stable/components/openniServer/openniServer.cpp
Log:
#189 Integrated with naming service (disabled by default)
Modified: trunk/src/stable/components/openniServer/CMakeLists.txt
===================================================================
--- trunk/src/stable/components/openniServer/CMakeLists.txt 2014-03-17 10:12:51 UTC (rev 1192)
+++ trunk/src/stable/components/openniServer/CMakeLists.txt 2014-03-17 10:16:19 UTC (rev 1193)
@@ -47,7 +47,8 @@
${OpenCV_LIBRARIES}
${OpenCVGUI_LIBRARIES}
${gsl_LIBRARIES}
- logger
+ logger
+ ns
jderobotutil
geometry
colorspacesmm
@@ -68,7 +69,8 @@
geometry
colorspacesmm
JderobotInterfaces
- logger
+ logger
+ ns
${OPENNI2_LIB}
${Boost_LIBRARIES}
${LIBXML2_LIBRARIES}
Modified: trunk/src/stable/components/openniServer/openniServer.cfg
===================================================================
--- trunk/src/stable/components/openniServer/openniServer.cfg 2014-03-17 10:12:51 UTC (rev 1192)
+++ trunk/src/stable/components/openniServer/openniServer.cfg 2014-03-17 10:16:19 UTC (rev 1193)
@@ -8,6 +8,9 @@
openniServer.Hz=20
+NamingService.Enabled=0
+NamingService.Proxy=NamingServiceJdeRobot:default -h 0.0.0.0 -p 10000
+
#mode=0 -> fps: 30x: 320y 240
#mode=2 -> fps: 60x: 320y 240
#mode=4 -> fps: 30x: 640y 480
@@ -22,6 +25,7 @@
openniServer.CameraRGB.PlayerDetection=0
openniServer.CameraRGB.Mirror=0
+
#openniServer.calibration=camera-0.cfg
openniServer.CameraDEPTH.Name=cameraB
openniServer.CameraDEPTH.Format=RGB8
@@ -53,3 +57,4 @@
openniServer.Log.File.Name=./log/openniServer.txt
openniServer.Log.File.Level=0
openniServer.Log.Screen.Level=0
+
Modified: trunk/src/stable/components/openniServer/openniServer.cpp
===================================================================
--- trunk/src/stable/components/openniServer/openniServer.cpp 2014-03-17 10:12:51 UTC (rev 1192)
+++ trunk/src/stable/components/openniServer/openniServer.cpp 2014-03-17 10:16:19 UTC (rev 1193)
@@ -44,8 +44,8 @@
#include <opencv2/video/background_segm.hpp>
#include <signal.h>
#include <log/Logger.h>
+#include <ns/ns.h>
-
#ifdef WITH_NITE2
#include "NiTE.h"
#endif
@@ -115,7 +115,6 @@
int mainFPS;
-
void* updateThread(void*)
{
@@ -1158,6 +1157,8 @@
openniServer::CameraRGB *camRGB;
openniServer::CameraDEPTH *camDEPTH;
openniServer::pointCloudI *pc1;
+jderobot::ns* namingService = NULL;
+std::vector<std::string> bindNamingService;
void exitApplication(int s){
@@ -1172,6 +1173,16 @@
if (pc1 != NULL){
delete pc1;
}
+
+ // NamingService
+ if (namingService != NULL)
+ {
+ for(std::vector<std::string>::iterator it = bindNamingService.begin(); it!=bindNamingService.end(); it++)
+ namingService->unbind(*it);
+
+ delete(namingService);
+ }
+
ic->shutdown();
@@ -1258,9 +1269,6 @@
std::string Endpoints = prop->getProperty(componentPrefix + ".Endpoints");
Ice::ObjectAdapterPtr adapter =ic->createObjectAdapterWithEndpoints(componentPrefix, Endpoints);
-
-
-
if (openniServer::segmentationType){
cameraR=1;
cameraD=1;
@@ -1317,7 +1325,23 @@
sync.release();
+ // Naming Service
+ int nsActive = prop->getPropertyAsIntWithDefault("NamingService.Enabled", 0);
+ if (nsActive)
+ {
+ std::string ns_proxy = prop->getProperty("NamingService.Proxy");
+ try
+ {
+ namingService = new jderobot::ns(ic, ns_proxy);
+ }
+ catch (Ice::ConnectionRefusedException& ex)
+ {
+ jderobot::Logger::getInstance()->error("Impossible to connect with NameService!");
+ exit(-1);
+ }
+ }
+
if (cameraR){
std::string objPrefix(componentPrefix + ".CameraRGB.");
std::string cameraName = prop->getProperty(objPrefix + "Name");
@@ -1329,6 +1353,14 @@
camRGB = new openniServer::CameraRGB(objPrefix,prop);
adapter->add(camRGB, ic->stringToIdentity(cameraName));
jderobot::Logger::getInstance()->info(" -------- openniServer: Component: CameraRGB created successfully(" + Endpoints + "@" + cameraName );
+
+
+ if (nsActive)
+ {
+ namingService->bind(cameraName, Endpoints, camRGB->ice_staticId());
+ bindNamingService.push_back(cameraName);
+ }
+
}
if (cameraD){
@@ -1343,6 +1375,12 @@
adapter->add(camDEPTH, ic->stringToIdentity(cameraName));
//test camera ok
jderobot::Logger::getInstance()->info(" -------- openniServer: Component: CameraDEPTH created successfully(" + Endpoints + "@" + cameraName );
+
+ if (nsActive)
+ {
+ namingService->bind(cameraName, Endpoints, camDEPTH->ice_staticId());
+ bindNamingService.push_back(cameraName);
+ }
}
if (pointCloud){
More information about the Jderobot-admin
mailing list