[Jderobot-admin] jderobot-r1236 - trunk/src/stable/components/recorder

rocapal en jderobot.org rocapal en jderobot.org
Jue Mayo 29 13:34:31 CEST 2014


Author: rocapal
Date: 2014-05-29 13:34:31 +0200 (Thu, 29 May 2014)
New Revision: 1236

Modified:
   trunk/src/stable/components/recorder/CMakeLists.txt
   trunk/src/stable/components/recorder/recorder.cfg
   trunk/src/stable/components/recorder/recorder.cpp
Log:
#266 added recorder to namingservice


Modified: trunk/src/stable/components/recorder/CMakeLists.txt
===================================================================
--- trunk/src/stable/components/recorder/CMakeLists.txt	2014-05-29 11:18:57 UTC (rev 1235)
+++ trunk/src/stable/components/recorder/CMakeLists.txt	2014-05-29 11:34:31 UTC (rev 1236)
@@ -32,4 +32,5 @@
     JderobotInterfaces
     jderobotutil
     logger
+    ns
 )

Modified: trunk/src/stable/components/recorder/recorder.cfg
===================================================================
--- trunk/src/stable/components/recorder/recorder.cfg	2014-05-29 11:18:57 UTC (rev 1235)
+++ trunk/src/stable/components/recorder/recorder.cfg	2014-05-29 11:34:31 UTC (rev 1236)
@@ -1,5 +1,5 @@
 Recorder.FileName=datos.jde
-Recorder.nCameras=1
+Recorder.nCameras=2
 Recorder.nDethSensors=0
 Recorder.nLasers=0
 Recorder.DepthSensor1.Proxy=pointcloud1:tcp -h 127.0.0.1 -p 9998
@@ -29,7 +29,15 @@
 Recorder.Hz=20
 
 
+
+# Config to buffer mode
 Recorder.Buffer.Enabled=0
 Recorder.Buffer.Seconds=60
 Recorder.Endpoints=default -h 0.0.0.0 -p 9992
-Recorder.Name=Recorder1
+Recorder.Name=Recorder-Log
+
+# Naming Service (only to buffer mode)
+NamingService.Enabled=1
+NamingService.Proxy=NamingServiceJdeRobot:default -h 0.0.0.0 -p 10000
+
+

Modified: trunk/src/stable/components/recorder/recorder.cpp
===================================================================
--- trunk/src/stable/components/recorder/recorder.cpp	2014-05-29 11:18:57 UTC (rev 1235)
+++ trunk/src/stable/components/recorder/recorder.cpp	2014-05-29 11:34:31 UTC (rev 1236)
@@ -30,6 +30,7 @@
 #include "poolWriteLasers.h"
 #include "poolWritePointCloud.h"
 #include "poolWriteEncoders.h"
+#include <ns/ns.h>
 
 bool recording=false;
 struct timeval inicio;
@@ -181,6 +182,7 @@
 
 std::vector<recorder::poolWriteImages*> poolImages;
 Ice::ObjectAdapterPtr adapter;
+jderobot::ns* namingService = NULL;
 
 void exitApplication(int s){
 	globalActive=false;
@@ -239,6 +241,14 @@
 		delete(poolImages[i]);
 	}
 
+	// NamingService
+	if (namingService != NULL)
+	{
+		namingService->unbindAll();
+
+		delete(namingService);
+	}
+
    if (ic)
 	   ic->destroy();
 }
@@ -433,6 +443,7 @@
 
 		if (bufferEnabled)
 		{
+
 			// Analyze EndPoint
 			std::string Endpoints = prop->getProperty("Recorder.Endpoints");
 			adapter =ic->createObjectAdapterWithEndpoints("Recorder", Endpoints);
@@ -442,6 +453,31 @@
 			adapter->add(recorder_prx, ic->stringToIdentity(name));
 
 			adapter->activate();
+
+
+			// 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);
+				}
+
+				namingService->bind(name, Endpoints, recorder_prx->ice_staticId());
+
+			}
+
+
+
+
 		}
 
 



More information about the Jderobot-admin mailing list