[Jderobot-admin] jderobot-r901 - in trunk: . Deps Deps/nite2 Deps/openni2 src/components src/components/openniServer src/components/openniServer/build src/components/openniServer/build-independent src/components/openniServer/config src/components/openniServer-kinect

frivas en jderobot.org frivas en jderobot.org
Mar Abr 16 11:46:00 CEST 2013


Author: frivas
Date: 2013-04-16 11:44:59 +0200 (Tue, 16 Apr 2013)
New Revision: 901

Added:
   trunk/Deps/nite2/
   trunk/Deps/nite2/CMakeLists.txt
   trunk/Deps/openni2/
   trunk/Deps/openni2/CMakeLists.txt
   trunk/src/components/openniServer/
   trunk/src/components/openniServer/CMakeLists.txt
   trunk/src/components/openniServer/build-independent/
   trunk/src/components/openniServer/build-independent/CMakeLists.txt
   trunk/src/components/openniServer/build/
   trunk/src/components/openniServer/build/CMakeLists.txt
   trunk/src/components/openniServer/build/clean.sh
   trunk/src/components/openniServer/config/
   trunk/src/components/openniServer/config/camRGB
   trunk/src/components/openniServer/config/lambecom.cfg
   trunk/src/components/openniServer/myprogeo.cpp
   trunk/src/components/openniServer/myprogeo.h
   trunk/src/components/openniServer/openni2.cpp
   trunk/src/components/openniServer/openniServer.cfg
   trunk/src/components/openniServer/openniServer.cpp
Modified:
   trunk/CMakeLists.txt
   trunk/src/components/openniServer-kinect/CMakeLists.txt
Log:
a?\195?\177adido openniserver con openni2 y nite2


Modified: trunk/CMakeLists.txt
===================================================================
--- trunk/CMakeLists.txt	2013-04-16 08:45:20 UTC (rev 900)
+++ trunk/CMakeLists.txt	2013-04-16 09:44:59 UTC (rev 901)
@@ -17,7 +17,7 @@
 		cameraview			recorder
 		cameraview_icestorm  kinectViewer        replayer
 		wiimoteClient
-		wiimoteServer       colortuner
+		wiimoteServer       colortuner openniServer
 		
 ) #Componentes que forman JDErobot
 

Added: trunk/Deps/nite2/CMakeLists.txt
===================================================================
--- trunk/Deps/nite2/CMakeLists.txt	                        (rev 0)
+++ trunk/Deps/nite2/CMakeLists.txt	2013-04-16 09:44:59 UTC (rev 901)
@@ -0,0 +1,24 @@
+# CHECK NITE
+SET ( NITE2_INC $ENV{NITE2_INCLUDE})
+SET ( NITE2_LIB $ENV{NITE2_REDIST})
+
+if (NITE2_INC AND NITE2_LIB)
+	message(STATUS "NITE found at ${NITE2_LIB}")
+	set_property(
+  		SOURCE openniServer.cpp
+   	PROPERTY COMPILE_DEFINITIONS WITH_NITE2=1
+	include_directories(${NITE2_INC})
+	link_directories(${NITE2_LIB}/libNiTE2.so)
+	if (NOT IS_DIRECTORY ./NiTE2)
+		message ("--CMake will install local NiTE2 lib and Driver")
+		file (COPY ${NITE2_LIB}/libNiTE2.so DESTINATION .)
+		file (COPY ${NITE2_LIB}/NiTE2 DESTINATION .)
+	endif()
+
+   	)
+else()
+	message("NITE2 library not found")
+endif()
+
+
+

Added: trunk/Deps/openni2/CMakeLists.txt
===================================================================
--- trunk/Deps/openni2/CMakeLists.txt	                        (rev 0)
+++ trunk/Deps/openni2/CMakeLists.txt	2013-04-16 09:44:59 UTC (rev 901)
@@ -0,0 +1,17 @@
+#manual openni libraries
+SET ( OPENNI2_INC $ENV{OPENNI2_INCLUDE})
+SET ( OPENNI2_LIB $ENV{OPENNI2_REDIST})
+
+if (OPENNI2_INC AND OPENNI2_LIB)
+	message(STATUS "OpenNI found at ${OPENNI2_LIB}")
+	include_directories(${OPENNI2_INC})
+	link_directories(${OPENNI2_LIB}/libOpenNI2.so)
+	if (NOT IS_DIRECTORY ./OpenNI2)
+		message ("--CMake will install local OpenNI2 lib and Driver")
+		file (COPY ${OPENNI2_LIB}/libOpenNI2.so DESTINATION .)
+		file (COPY ${OPENNI2_LIB}/OpenNI2 DESTINATION .)
+	endif()
+else()
+	message("OpenNI2 library not found")
+endif()
+

Added: trunk/src/components/openniServer/CMakeLists.txt
===================================================================
--- trunk/src/components/openniServer/CMakeLists.txt	                        (rev 0)
+++ trunk/src/components/openniServer/CMakeLists.txt	2013-04-16 09:44:59 UTC (rev 901)
@@ -0,0 +1,67 @@
+#SET( DEPS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../Deps) # Directorio donde se encuentran las dependencias
+#include(${DEPS_DIR}/openni2/CMakeLists.txt)
+#include(${DEPS_DIR}/nite2/CMakeLists.txt)
+
+IF(OPENNI2_LIB)
+	#check for the path openni libs
+	
+
+
+	SET( SOURCE_FILES openniServer.cpp myprogeo.cpp )
+    add_definitions(-DGLADE_DIR="${gladedir}")
+
+	set( CMAKE_CXX_FLAGS "-Wno-deprecated -Wl,-rpath ./" ) # Opciones para el compilador
+
+    include_directories(
+        ${INTERFACES_CPP_DIR}
+        ${LIBS_DIR}/
+        ${CMAKE_CURRENT_SOURCE_DIR}
+        ${CMAKE_CURRENT_SOURCE_DIR}/cameras
+    )
+
+    add_executable (openniServer ${SOURCE_FILES})
+	#copy openni libs to local path
+	if (NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/OpenNI2)
+		message ("--CMake will install local OpenNI2 lib and Driver")
+		file (COPY ${OPENNI2_LIB}/libOpenNI2.so DESTINATION .)
+		set (concat "/")
+		file (COPY ${OPENNI2_LIB}/OpenNI2 DESTINATION ${CMAKE_CURRENT_SOURCE_DIR})
+	endif()
+	message ("-----------------------------------" ${LIBS_DIR})
+
+
+	if  ( NITE2_LIB )
+		#copy nite libs to local path
+		if (NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/NiTE2)
+			message ("--CMake will install local NiTE2 lib and Driver")
+			file (COPY ${NITE2_LIB}/libNiTE2.so DESTINATION .)
+			file (COPY ${NITE2_LIB}/NiTE2 DESTINATION ${CMAKE_CURRENT_SOURCE_DIR})
+		endif()
+	TARGET_LINK_LIBRARIES(openniServer
+		${Gearbox_LIBRARIES}
+        ${ZeroCIce_LIBRARIES}
+        ${opencv_LIBRARIES}
+        ${gsl_LIBRARIES}
+		${LIBS_DIR}/jderobotice/libjderobotice.so
+        ${LIBS_DIR}/jderobotutil/libjderobotutil.so
+        ${LIBS_DIR}/progeo/libprogeo.so
+        ${LIBS_DIR}/colorspaces/libcolorspacesmm.so
+        ${INTERFACES_CPP_DIR}/jderobot/libJderobotInterfaces.so
+		${OPENNI2_LIB}/libOpenNI2.so
+		${NITE2_LIB}/libNiTE2.so
+	)
+	else()
+	TARGET_LINK_LIBRARIES(openniServer
+		${Gearbox_LIBRARIES}
+		${ZeroCIce_LIBRARIES}
+		${opencv_LIBRARIES}
+		${gsl_LIBRARIES}
+		${LIBS_DIR}/jderobotice/libjderobotice.so
+        ${LIBS_DIR}/jderobotutil/libjderobotutil.so
+        ${LIBS_DIR}/progeo/libprogeo.so
+        ${LIBS_DIR}/colorspaces/libcolorspacesmm.so
+        ${INTERFACES_CPP_DIR}/jderobot/libJderobotInterfaces.so
+		${OPENNI2_LIB}/libOpenNI2.so
+	)
+	endif()
+ENDIF()

Added: trunk/src/components/openniServer/build/CMakeLists.txt
===================================================================
--- trunk/src/components/openniServer/build/CMakeLists.txt	                        (rev 0)
+++ trunk/src/components/openniServer/build/CMakeLists.txt	2013-04-16 09:44:59 UTC (rev 901)
@@ -0,0 +1,135 @@
+project (JDEROBOT_OPENNISERVER)
+
+cmake_minimum_required(VERSION 2.8)
+
+# ENV VARS
+SET(gladedir ./)
+
+SET( INTERFACES_CPP_JDEROBOT ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/interfaces/cpp/jderobot)
+SET( INTERFACES_CPP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../interfaces/cpp) # Directorio con las interfaces ICE en C++
+SET( LIBS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs) # Directorio donde se encuentran las librerias propias de jderobot
+SET( SLICE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../interfaces/slice) # Directorio donde se encuentran las interfaces ICE
+SET( LIBS_NEEDED bgfgsegmentation jderobotice colorspaces 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
+
+###################
+#                 #
+#  CHECK SYSTEM   #
+#                 #
+###################
+
+  # FIND & CHECK PRINCIPAL LIBRARIES
+include(FindPkgConfig)
+
+PKG_CHECK_MODULES(opencv REQUIRED opencv)
+include_directories(${opencv_INCLUDE_DIRS})
+link_directories(${opencv_LIBRARY_DIRS})
+
+PKG_CHECK_MODULES(libglademm REQUIRED libglademm-2.4)
+include_directories(${libglademm_INCLUDE_DIRS})
+link_directories(${libglademm_LIBRARY_DIRS})
+
+PKG_CHECK_MODULES(gsl REQUIRED gsl)
+include_directories(${gsl_INCLUDE_DIRS})
+link_directories(${gsl_LIBRARIES_DIRS})
+
+#PKG_CHECK_MODULES(gthread REQUIRED gthread-2.0)
+#include_directories(${gthread_INCLUDE_DIRS})
+#link_directories(${gthread_LIBRARY_DIRS})
+
+#PKG_CHECK_MODULES(gtk20 REQUIRED gtk+-2.0)
+#include_directories(${gtk20_INCLUDE_DIRS})
+#link_directories(${gtk20_LIBRARY_DIRS})
+
+#PKG_CHECK_MODULES(gtkgl20 REQUIRED gtkgl-2.0)
+#include_directories(${gtkgl20_INCLUDE_DIRS})
+#link_directories(${gtkgl20_LIBRARY_DIRS})
+
+#PKG_CHECK_MODULES(gtkmm REQUIRED gtkmm-2.4)
+#include_directories(${gtkmm_INCLUDE_DIRS})
+#link_directories(${gtkmm_LIBRARY_DIRS})
+
+#PKG_CHECK_MODULES(gtkglextmm REQUIRED gtkglextmm-1.2)
+#include_directories(${gtkglextmm_INCLUDE_DIRS})
+#link_directories(${gtkglextmm_LIBRARY_DIRS})
+
+#PKG_CHECK_MODULES(libgnomecanvas REQUIRED libgnomecanvas-2.0)
+#include_directories(${libgnomecanvas_INCLUDE_DIRS})
+#link_directories(${libgnomecanvas_LIBRARY_DIRS})
+
+#PKG_CHECK_MODULES(libgnomecanvasmm REQUIRED libgnomecanvasmm-2.6)
+#include_directories(${libgnomecanvasmm_INCLUDE_DIRS})
+#link_directories(${libgnomecanvasmm_LIBRARY_DIRS})
+
+  # FIND AND CHECK OTHER DEPENDENCES
+include(${DEPS_DIR}/gearbox/CMakeLists.txt)
+include(${DEPS_DIR}/openni2/CMakeLists.txt)
+include(${DEPS_DIR}/nite2/CMakeLists.txt)
+include(${DEPS_DIR}/ice/CMakeLists.txt)
+include(${DEPS_DIR}/opencv/CMakeLists.txt)
+#include(${DEPS_DIR}/fireware/CMakeLists.txt)
+#include(${DEPS_DIR}/pcl/CMakeLists.txt)
+#include(${DEPS_DIR}/player/CMakeLists.txt)
+#include(${DEPS_DIR}/xerces/CMakeLists.txt)
+
+# START RECURSIVE
+add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR}/../../.. ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
+add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/..)
+
+###################
+#                 #
+#    INSTALL      #
+#                 #
+###################
+
+# Install libraries
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/interfaces/cpp/jderobot/libJderobotInterfaces.so DESTINATION /usr/local/lib/jderobot)
+
+FOREACH(currentLibFile ${LIBS_NEEDED})
+    SET (new_lib "lib${currentLibFile}.so")
+    MESSAGE("${new_lib}")    
+    INSTALL (FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libs/${currentLibFile}/${new_lib} DESTINATION /usr/local/lib/jderobot)
+ENDFOREACH(currentLibFile)
+
+# Install libraries headers
+FILE(GLOB_RECURSE HEADERS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libs/*.h)
+FOREACH(currentSourceFile ${HEADERS_FILES})
+    string(REGEX REPLACE ".*/(.*/).*.h" "\\1" new_source1 ${currentSourceFile})
+    INSTALL (FILES ${currentSourceFile} DESTINATION /usr/local/include/jderobot/${new_source1})
+ENDFOREACH(currentSourceFile)
+
+# Install Executables
+FILE(GLOB_RECURSE BIN_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../*cfg)
+    string(REGEX REPLACE ".*/(.*).cfg" "\\1" new_source1 ${BIN_FILES})
+INSTALL (FILES ../${new_source1}  DESTINATION /usr/local/bin PERMISSIONS OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE)
+
+# Install interfaces headers
+FILE(GLOB HEADER_INTERFACE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/interfaces/cpp/jderobot/*.h)
+INSTALL (FILES ${HEADER_INTERFACE_FILES} DESTINATION /usr/local/include/jderobot/jderobot)
+
+# Install slice
+FILE(GLOB SLICE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/interfaces/slice/jderobot/*.ice)
+INSTALL (FILES ${SLICE_FILES} DESTINATION /usr/local/include/jderobot/slice)
+
+# Install CONF
+FILE(GLOB_RECURSE CONF_FILES  ${CMAKE_CURRENT_SOURCE_DIR}/../*cfg)
+INSTALL (FILES ${CONF_FILES} DESTINATION /usr/local/share/jderobot/conf)
+
+# Install Glade
+#FILE(GLOB_RECURSE GLADE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../*.glade)
+#INSTALL (FILES ${GLADE_FILES} DESTINATION /usr/local/share/jderobot/glade)
+
+###################
+#                 #
+#    UNINSTALL    #
+#                 #
+###################
+
+configure_file(
+    "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
+    "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
+    IMMEDIATE @ONLY)
+
+add_custom_target(uninstall
+    COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
+

Added: trunk/src/components/openniServer/build/clean.sh
===================================================================
--- trunk/src/components/openniServer/build/clean.sh	                        (rev 0)
+++ trunk/src/components/openniServer/build/clean.sh	2013-04-16 09:44:59 UTC (rev 901)
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+make clean
+rm ../cmake_install.cmake
+rm -r CMakeFiles
+rm -r ../CMakeFiles
+mkdir ../temp
+mv CMakeLists.txt ../temp
+mv clean.sh ../temp
+mv cmake_uninstall.cmake.in ../temp
+rm -r *
+mv ../temp/CMakeLists.txt .
+mv ../temp/clean.sh .
+mv ../temp/cmake_uninstall.cmake.in .
+rm -r ../temp
+cd ../../../../
+./clean_repository 


Property changes on: trunk/src/components/openniServer/build/clean.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/src/components/openniServer/build-independent/CMakeLists.txt
===================================================================
--- trunk/src/components/openniServer/build-independent/CMakeLists.txt	                        (rev 0)
+++ trunk/src/components/openniServer/build-independent/CMakeLists.txt	2013-04-16 09:44:59 UTC (rev 901)
@@ -0,0 +1,147 @@
+ cmake_minimum_required(VERSION 2.8)
+SET( SOURCE_FILES ../openniServer.cpp ../myprogeo.cpp)
+SET( LIBS_DIR /usr/local/lib/jderobot/)
+
+
+
+include_directories(
+	  /usr/local/include/jderobot
+)
+
+add_executable (openniServer  ${SOURCE_FILES})
+
+#automated opencv
+include(FindPkgConfig)
+PKG_CHECK_MODULES(opencv REQUIRED opencv)
+include_directories(${opencv_INCLUDE_DIRS})
+link_directories(${opencv_LIBRARY_DIRS})
+#automated gsl
+PKG_CHECK_MODULES(gsl REQUIRED gsl)
+include_directories(${gsl_INCLUDE_DIRS})
+link_directories(${gsl_LIBRARY_DIRS})
+
+
+
+
+#manual openni libraries
+SET ( OPENNI2_INC $ENV{OPENNI2_INCLUDE})
+SET ( OPENNI2_LIB $ENV{OPENNI2_REDIST})
+
+if (OPENNI2_INC AND OPENNI2_LIB)
+	message(STATUS "OpenNI found at ${OPENNI2_LIB}")
+else()
+	message(FATAL_ERROR "OpenNI2 library not found")
+endif()
+include_directories(${OPENNI2_INC})
+link_directories(${OPENNI2_LIB}/libOpenNI2.so)
+
+
+#manual nite libraries
+SET ( NITE2_INC $ENV{NITE2_INCLUDE})
+SET ( NITE2_LIB $ENV{NITE2_REDIST})
+
+if (NITE2_INC AND NITE2_LIB)
+	message(STATUS "NITE found at ${NITE2_LIB}")
+	set_property(
+  		SOURCE openniServer.cpp
+   	PROPERTY COMPILE_DEFINITIONS WITH_NITE2=1
+   	)
+else()
+	message("NITE2 library not found")
+endif()
+include_directories(${NITE2_INC})
+link_directories(${NITE2_LIB}/libNiTE2.so)
+
+
+#manual gearbox libraries
+FIND_PATH( Gearbox_INCLUDE_DIR NAMES gbxutilacfr/gbxutilacfr.h  PATHS ENV C++LIB ENV PATH PATH_SUFFIXES gearbox)
+ 
+IF( Gearbox_INCLUDE_DIR )
+    FIND_LIBRARY( Gearbox_LIBRARY1 NAMES GbxUtilAcfr PATHS ENV C++LIB ENV PATH PATH_SUFFIXES lib/gearbox lib64/gearbox )
+    FIND_LIBRARY( Gearbox_LIBRARY2 NAMES GbxIceUtilAcfr PATHS ENV C++LIB ENV PATH PATH_SUFFIXES lib/gearbox lib64/gearbox)
+    SET (Gearbox_LIBRARIES ${Gearbox_LIBRARY1} ${Gearbox_LIBRARY2})
+    IF( Gearbox_LIBRARIES )
+		MESSAGE ("-- Gearbox found at ${Gearbox_LIBRARIES}")
+		include_directories(${Gearbox_INCLUDE_DIR})
+		link_directories(${Gearbox_LIBRARIES})
+    ENDIF( Gearbox_LIBRARIES )
+ENDIF(Gearbox_INCLUDE_DIR)
+
+IF(NOT Gearbox_LIBRARIES)
+		MESSAGE ("*** Gearbox not found")
+ENDIF()
+
+
+#manual ICE
+FIND_PATH( Ice_INCLUDE_DIR NAMES Ice/Ice.h  PATHS ENV C++LIB ENV)
+ 
+IF( Ice_INCLUDE_DIR )
+    FIND_LIBRARY( Ice_LIBRARY1 NAMES Ice PATHS ENV C++LIB ENV PATH PATH_SUFFIXES lib lib64 )
+    FIND_LIBRARY( Ice_LIBRARY2 NAMES IceUtil PATHS ENV C++LIB ENV PATH PATH_SUFFIXES lib lib64)
+    SET (Ice_LIBRARIES ${Ice_LIBRARY1} ${Ice_LIBRARY2})
+    IF( Ice_LIBRARIES )
+		MESSAGE ("-- Ice found at ${Ice_LIBRARIES}")
+		include_directories(${Ice_INCLUDE_DIR})
+		link_directories(${Ice_LIBRARIES})
+    ENDIF( Ice_LIBRARIES )
+ENDIF(Ice_INCLUDE_DIR)
+
+IF(NOT Ice_LIBRARIES)
+		MESSAGE ("*** Ice not found")
+ENDIF()
+
+
+#PKG_CHECK_MODULES(gearbox gearbox)
+#include_directories(${gearbox_INCLUDE_DIRS})
+#link_directories(${gearbox_LIBRARY_DIRS})
+#message(STATUS "${gearbox_LIBRARY_DIRS}")
+#message(STATUS "${gearbox_INCLUDE_DIRS}")
+
+
+set( CMAKE_CXX_FLAGS "-Wno-deprecated -Wl,-rpath ./" ) # Opciones para el compilador
+
+if (NOT IS_DIRECTORY ./OpenNI2)
+	message ("--CMake will install local OpenNI2 lib and Driver")
+	file (COPY ${OPENNI2_LIB}/libOpenNI2.so DESTINATION .)
+	file (COPY ${OPENNI2_LIB}/OpenNI2 DESTINATION .)
+	
+endif()
+
+
+
+
+if  ( NITE2_LIB )
+	if (NOT IS_DIRECTORY ./NiTE2)
+	message ("--CMake will install local NiTE2 lib and Driver")
+	file (COPY ${NITE2_LIB}/libNiTE2.so DESTINATION .)
+	file (COPY ${NITE2_LIB}/NiTE2 DESTINATION .)
+
+	endif()
+
+	TARGET_LINK_LIBRARIES(openniServer
+	  ${opencv_LIBRARIES}
+	  ${gsl_LIBRARIES}
+	  ${Gearbox_LIBRARIES}
+	  ${Ice_LIBRARIES}
+	  ${LIBS_DIR}/libcolorspacesmm.so
+	  ${LIBS_DIR}/libJderobotInterfaces.so
+	  ${LIBS_DIR}/libjderobotice.so
+	  ${LIBS_DIR}/libjderobotutil.so
+	  ${LIBS_DIR}/libprogeo.so
+	  ${OPENNI2_LIB}/libOpenNI2.so
+	  ${NITE2_LIB}/libNiTE2.so
+	)
+else()
+	TARGET_LINK_LIBRARIES(openniServer
+	  ${opencv_LIBRARIES}
+	  ${gsl_LIBRARIES}
+	  ${Gearbox_LIBRARIES}
+	  ${Ice_LIBRARIES}
+	  ${LIBS_DIR}/libcolorspacesmm.so
+	  ${LIBS_DIR}/libJderobotInterfaces.so
+	  ${LIBS_DIR}/libjderobotice.so
+	  ${LIBS_DIR}/libjderobotutil.so
+	  ${LIBS_DIR}/libprogeo.so
+	  ${OPENNI2_LIB}/libOpenNI2.so
+	)
+endif()

Added: trunk/src/components/openniServer/config/camRGB
===================================================================
--- trunk/src/components/openniServer/config/camRGB	                        (rev 0)
+++ trunk/src/components/openniServer/config/camRGB	2013-04-16 09:44:59 UTC (rev 901)
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<calibration_camera>
+  <position>
+    <x>1895,000000</x>
+    <y>4983,000000</y>
+    <z>857,000000</z>
+  </position>
+  <foa>
+    <x>4633,000000</x>
+    <y>642,000000</y>
+    <z>1088,000000</z>
+  </foa>
+  <k_matrix>
+    <k11>515,000000</k11>
+    <k12>0,000000</k12>
+    <k13>219,000000</k13>
+    <k14>0,000000</k14>
+    <k21>0,000000</k21>
+    <k22>515,000000</k22>
+    <k23>323,000000</k23>
+    <k24>0,000000</k24>
+    <k31>0,000000</k31>
+    <k32>0,000000</k32>
+    <k33>1,000000</k33>
+    <k34>0,000000</k34>
+  </k_matrix>
+  <rt_matrix>
+    <rt11>-0,023987</rt11>
+    <rt12>0,038030</rt12>
+    <rt13>0,998989</rt13>
+    <rt14>-1000,183655</rt14>
+    <rt21>-0,845813</rt21>
+    <rt22>-0,533480</rt22>
+    <rt23>0,000000</rt23>
+    <rt24>4261,145020</rt24>
+    <rt31>0,532940</rt31>
+    <rt32>-0,844957</rt32>
+    <rt33>0,044963</rt33>
+    <rt34>3161,967529</rt34>
+    <rt31>0,532940</rt31>
+    <rt32>-0,844957</rt32>
+    <rt33>0,044963</rt33>
+    <rt34>3161,967529</rt34>
+  </rt_matrix>
+  <roll>0,000000</roll>
+  <fdistx>515,000000</fdistx>
+  <fdisty>515,000000</fdisty>
+  <u0>219,000000</u0>
+  <v0>323,000000</v0>
+  <skew>0,000000</skew>
+  <rows>480</rows>
+  <columns>640</columns>
+</calibration_camera>

Added: trunk/src/components/openniServer/config/lambecom.cfg
===================================================================
--- trunk/src/components/openniServer/config/lambecom.cfg	                        (rev 0)
+++ trunk/src/components/openniServer/config/lambecom.cfg	2013-04-16 09:44:59 UTC (rev 901)
@@ -0,0 +1,126 @@
+cameraINfile 0 worldconfig/camA-in
+cameraINfile 1 worldconfig/camB-in
+cameraINfile 2 worldconfig/camC-in
+cameraINfile 3 worldconfig/camD-in
+#cameraINfile 4 /users/s.alons/eldercare-config/worldconfig/camE-in
+cameraINfile 4 worldconfig/camV-in
+#units:milimeters
+#lambecom
+#floor
+#2
+worldline 0 0 0 1 970 0 0 1
+worldline 970 0 0 1 970 800 0 1
+worldline 970 800 0 1 2630 800 0 1
+worldline 2630 800 0 1 2630 0 0 1
+worldline 2630 0 0 1 7495 0 0 1
+worldline 7495 0 0 1 7495 180 0 1
+worldline 7495 180 0 1 7935 180 0 1
+worldline 7935 180 0 1 7935 780 0 1
+worldline 7935 780 0 1 8765 780 0 1
+#1
+worldline 8765 780 0 1 8765 6330 0 1
+worldline 8765 6330 0 1 8165 6330 0 1
+worldline 8165 6330 0 1 8165 6710 0 1
+#4
+worldline 8165 6710 0 1 8165 5950 0 1
+worldline 8165 5950 0 1 6580 5950 0 1
+worldline 6580 5950 0 1 6580 6710 0 1
+worldline 8165 6710 0 1 2510 6710 0 1
+worldline 2510 6710 0 1 2510 6380 0 1
+worldline 2510 6380 0 1 1940 6380 0 1
+worldline 1940 6380 0 1 1940 6710 0 1
+worldline 1940 6710 0 1 0 6710 0 1
+#walkway
+worldline 8645 1870 0 1 8645 4310 0 1
+worldline 8645 4310 0 1 0 4310 0 1
+worldline 0 4310 0 1 0 1870 0 1
+worldline 0 1870 0 1 8645 1870 0 1
+worldline 8645 1870 110 1 8645 4310 110 1
+worldline 8645 4310 0 1 110 4310 110 1
+worldline 0 4310 110 1 0 1870 110 1
+worldline 0 1870 110 1 8645 1870 110 1
+#forceplates
+worldline 3765 2890 110 1 3160 2890 110 1
+worldline 3160 2890 110 1 3160 3290 110 1
+worldline 3160 3290 110 1 3765 3290 110 1
+worldline 3765 3290 110 1 3765 2890 110 1
+worldline 3110 2890 110 1 2505 2890 110 1
+worldline 2505 2890 110 1 2505 3290 110 1
+worldline 2505 3290 110 1 3110 3290 110 1
+worldline 3110 3290 110 1 3110 2890 110 1
+#PC DESK
+#floor
+worldline 5165 4965 0 1 2630 4965 0 1
+worldline 2630 4965 0 1 2630 5715 0 1
+worldline 2630 5715 0 1 5165 5715 0 1
+worldline 5165 5715 0 1 5165 4965 0 1
+#top
+worldline 5165 4965 760 1 2630 4965 760 1
+worldline 2630 4965 760 1 2630 5715 760 1
+worldline 2630 5715 760 1 5165 5715 760 1
+worldline 5165 5715 760 1 5165 4965 760 1
+#up lines
+worldline 5165 4965 0 1 5165 4965 760 1
+worldline 2630 4965 0 1 2630 4965 760 1
+worldline 2630 5715 0 1 2630 5715 760 1
+worldline 5165 5715 0 1 5165 5715 760 1
+#OTHER TABLE
+worldline 8165 6710 0 1 8165 6710 880 1
+worldline 8165 5950 0 1 8165 5950 880 1
+worldline 6580 5950 0 1 6580 5950 880 1
+worldline 6580 6710 0 1 6580 6710 880 1
+#top
+worldline 8165 6710 880 1 8165 5950 880 1
+worldline 8165 5950 880 1 6580 5950 880 1
+worldline 6580 5950 880 1 6580 6710 880 1
+worldline 6580 6710 880 1 8165 6710 880 1
+#WALLS
+#1
+worldline 8165 6710 0 1 8165 6710 3000 1
+worldline 8165 6330 0 1 8165 6330 3000 1
+worldline 8765 6330 0 1 8765 6330 3000 1
+worldline 8765 780 0 1 8765 780 3000 1
+worldline 7935 780 0 1 7935 780 3000 1
+worldline 7935 180 0 1 7935 180 3000 1
+worldline 7495 180 0 1 7495 180 3000 1
+worldline 7495 0 0 1 7495 0 3000 1
+#1 top
+worldline 8165 6710 3000 1 8165 6330 3000 1
+worldline 8165 6330 3000 1 8765 6330 3000 1
+worldline 8765 6330 3000 1 8765 780 3000 1
+worldline 8765 780 3000 1 7935 780 3000 1
+worldline 7935 780 3000 1 7935 180 3000 1
+worldline 7935 180 3000 1 7495 180 3000 1
+worldline 7495 180 3000 1 7495 0 3000 1
+#1 door
+worldline 8765 5670 0 1 8765 5670 2110 1
+worldline 8765 5670 2110 1 8765 4680 2110 1
+worldline 8765 4680 2110 1 8765 4680 0 1
+#2	
+worldline 970 0 0 1 970 0 3000 1
+worldline 970 800 0 1 970 800 3000 1
+worldline 2630 800 0 1 2630 800 3000 1
+worldline 2630 0 0 1 2630 0 3000 1
+worldline 7495 0 0 1 7495 0 3000 1
+#2top
+worldline 970 0 3000 1 970 800 3000 1
+worldline 970 800 3000 1 2630 800 3000 1
+worldline 2630 800 3000 1 2630 0 3000 1
+worldline 2630 0 3000 1 7495 0 3000 1
+#worldline 7495 0 3000 1 7495 780 3000 1
+#2door
+worldline 6715 0 0 1 6715 0 3000 1
+worldline 4850 0 0 1 4850 0 3000 1
+worldline 6715 0 2035 1 4850 0 2035 1
+worldline 5815 0 0 1 5815 0 2035 1
+worldline 5819 0 0 1 5819 0 2035 1 
+#4
+worldline 2510 6710 0 1 2510 6710 3000 1
+worldline 2510 6380 0 1 2510 6380 3000 1
+worldline 1940 6380 0 1 1940 6380 3000 1
+worldline 1940 6710 0 1 1940 6710 3000 1
+#4 top
+worldline 8165 6710 3000 1 2510 6710 3000 1
+worldline 2510 6710 3000 1 2510 6380 3000 1
+worldline 2510 6380 3000 1 1940 6380 3000 1
+worldline 1940 6380 3000 1 1940 6710 3000 1

Added: trunk/src/components/openniServer/myprogeo.cpp
===================================================================
--- trunk/src/components/openniServer/myprogeo.cpp	                        (rev 0)
+++ trunk/src/components/openniServer/myprogeo.cpp	2013-04-16 09:44:59 UTC (rev 901)
@@ -0,0 +1,243 @@
+/*
+*  Copyright (C) 1997-2011 JDERobot Developers Team
+ *
+ *  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 2 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 Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *   Authors : Francisco Miguel Rivas Montero <franciscomiguel.rivas en urjc.es>
+ *             Jose María Cañas Plaza <jmplaza en gsyc.es>
+ *
+ */
+
+#include "myprogeo.h"
+
+
+namespace openniServer {
+myprogeo::myprogeo(){
+	std::cout << "CREADO" << std::endl;
+}
+
+myprogeo::~myprogeo(){
+}
+
+
+/* gets the calibration of the camera from a file */
+int myprogeo::load_cam_line(FILE *myfile,int cam)
+{		
+  char word1[MAX_BUFFER],word2[MAX_BUFFER];
+  int i=0;
+  char buffer_file[MAX_BUFFER];   
+  double roll;
+
+  buffer_file[0]=fgetc(myfile);
+  if (feof(myfile)) return EOF;
+  if (buffer_file[0]==(char)255) return EOF; 
+  if (buffer_file[0]=='#') {while(fgetc(myfile)!='\n'); return 0;}
+  if (buffer_file[0]==' ') {while(buffer_file[0]==' ') buffer_file[0]=fgetc(myfile);}
+  if (buffer_file[0]=='\t') {while(buffer_file[0]=='\t') buffer_file[0]=fgetc(myfile);}
+
+  //Captures a line and then we will process it with sscanf checking that the last character is \n. We can't doit with fscanf because this function does not difference \n from blank space. 
+  while((buffer_file[i]!='\n') && 
+	(buffer_file[i] != (char)255) &&  
+	(i<MAX_BUFFER-1) ) {
+    buffer_file[++i]=fgetc(myfile);
+  }
+  
+  if (i >= MAX_BUFFER-1) { 
+    printf("%s...\n", buffer_file); 
+    printf ("Line too long in config file!\n"); 
+    return -1;
+  }
+  buffer_file[++i]='\0';
+
+
+  if (sscanf(buffer_file,"%s",word1)!=1) return 0; 
+  // return EOF; empty line
+  else {
+    if (strcmp(word1,"positionX")==0){
+      sscanf(buffer_file,"%s %s",word1,word2);
+      cameras[cam].position.X=(float)atof(word2);
+    }
+    else if (strcmp(word1,"positionY")==0){
+      sscanf(buffer_file,"%s %s",word1,word2);
+      cameras[cam].position.Y=(float)atof(word2);
+    }
+    else if (strcmp(word1,"positionZ")==0){
+      sscanf(buffer_file,"%s %s",word1,word2);
+      cameras[cam].position.Z=(float)atof(word2);
+    }
+    else if (strcmp(word1,"positionH")==0){
+      sscanf(buffer_file,"%s %s",word1,word2);
+      cameras[cam].position.H=(float)atof(word2);
+    }
+    else if (strcmp(word1,"FOApositionX")==0){
+      sscanf(buffer_file,"%s %s",word1,word2);
+      cameras[cam].foa.X=(float)atof(word2);
+    }
+    else if (strcmp(word1,"FOApositionY")==0){
+      sscanf(buffer_file,"%s %s",word1,word2);
+      cameras[cam].foa.Y=(float)atof(word2);
+    }
+    else if (strcmp(word1,"FOApositionZ")==0){
+      sscanf(buffer_file,"%s %s",word1,word2);
+      cameras[cam].foa.Z=(float)atof(word2);
+    }
+    else if (strcmp(word1,"FOApositionH")==0){
+      sscanf(buffer_file,"%s %s",word1,word2);
+      cameras[cam].foa.H=(float)atof(word2);
+    }
+    else if (strcmp(word1,"roll")==0){
+      sscanf(buffer_file,"%s %s",word1,word2);
+      cameras[cam].roll=(float)atof(word2);
+    }
+    else if (strcmp(word1,"f")==0){
+      sscanf(buffer_file,"%s %s",word1,word2);
+      cameras[cam].fdistx=(float)atof(word2);
+      cameras[cam].fdisty=(float)atof(word2);
+     }
+    else if (strcmp(word1,"fx")==0){
+      sscanf(buffer_file,"%s %s",word1,word2);
+      cameras[cam].fdistx=(float)atof(word2);
+    }
+    else if (strcmp(word1,"fy")==0){
+      sscanf(buffer_file,"%s %s",word1,word2);
+      cameras[cam].fdisty=(float)atof(word2);
+     }
+    else if (strcmp(word1,"skew")==0){
+      sscanf(buffer_file,"%s %s",word1,word2);
+      cameras[cam].skew=(float)atof(word2);
+     }
+    else if (strcmp(word1,"u0")==0){
+      sscanf(buffer_file,"%s %s",word1,word2);
+      cameras[cam].u0=(float)atof(word2);
+    }
+    else if (strcmp(word1,"v0")==0){
+      sscanf(buffer_file,"%s %s",word1,word2);
+      cameras[cam].v0=(float)atof(word2);
+    } 
+    else if (strcmp(word1,"columns")==0){
+      sscanf(buffer_file,"%s %s",word1,word2);
+      cameras[cam].columns=(int)atoi(word2);
+    } 
+    else if (strcmp(word1,"rows")==0){
+      sscanf(buffer_file,"%s %s",word1,word2);
+      cameras[cam].rows=(int)atoi(word2);
+    } 
+  }
+ return 1;
+}
+
+/* gets the calibration of the camera from a file */
+void myprogeo::load_cam(char *fich_in,int cam, int w, int h)
+{
+  FILE *entrada;
+  int i;
+	if (strlen(fich_in) ==0 ){
+		std::cout << w << ", " << h << std::endl;
+		this->cameras[cam].fdistx=515;
+		this->cameras[cam].fdisty=515;
+		this->cameras[cam].u0=h/2;
+		this->cameras[cam].v0=w/2;
+		this->cameras[cam].position.X=0;
+		this->cameras[cam].position.Y=0;
+		this->cameras[cam].position.Z=0;
+		this->cameras[cam].foa.X=0;
+		this->cameras[cam].foa.Y=1;
+		this->cameras[cam].foa.Z=0;
+		update_camera_matrix(&cameras[cam]);
+
+		
+	}
+	else{
+		xmlReader(&(this->cameras[cam]), fich_in);
+		update_camera_matrix(&cameras[cam]);
+	}
+	/*this->cameras[cam].position.H=1;
+	this->cameras[cam].foa.H=1;*/
+
+	/*std::cout << fich_in << std::endl;
+  entrada=fopen(fich_in,"r");
+   if(entrada==NULL){
+     printf("tracker3D: camera input calibration file %s does not exits\n",fich_in);
+   }else{
+     do{i=load_cam_line(entrada,cam);}while(i!=EOF);
+     fclose(entrada);
+   } */
+  
+  display_camerainfo(cameras[cam]);
+}
+
+
+void
+myprogeo::mybackproject(float x, float y, float* xp, float* yp, float* zp, float* camx, float* camy, float* camz, int cam){
+	HPoint2D p;
+	HPoint3D pro;
+	
+
+
+
+	p.x=GRAPHIC_TO_OPTICAL_X(x,y); 
+	p.y=GRAPHIC_TO_OPTICAL_Y(x,y);
+	p.h=1;
+	backproject(&pro,p,cameras[cam]);
+	*xp=pro.X;
+	*yp=pro.Y;
+	*zp=pro.Z;
+
+	*camx=cameras[cam].position.X;
+	*camy=cameras[cam].position.Y;
+	*camz=cameras[cam].position.Z;
+}
+
+void 
+myprogeo::myproject(float x, float y, float z, float* xp, float* yp, int cam){
+	HPoint2D p;
+	HPoint3D p3;
+
+	p3.X=x;
+	p3.Y=y;
+	p3.Z=z;
+	p3.H=1;
+	
+	project(p3, &p, cameras[cam]);
+	*xp=p.x;
+	*yp=p.y;
+}
+
+void
+myprogeo::mygetcameraposition(float *x, float *y, float *z, int cam){
+	*x=cameras[cam].position.X;
+	*y=cameras[cam].position.Y;
+	*z=cameras[cam].position.Z;
+}
+
+void 
+myprogeo::mygetcamerafoa(float *x, float *y, float *z, int cam){
+	*x=cameras[cam].foa.X;
+	*y=cameras[cam].foa.Y;
+	*z=cameras[cam].foa.Z;
+}
+
+void 
+myprogeo::mygetcamerasize(float *w, float *h, int cam){
+	*w = cameras[cam].columns;
+	*h = cameras[cam].rows;
+}
+
+TPinHoleCamera 
+myprogeo::getCamera(int camera){
+	return cameras[camera];
+}
+
+} //namespace

Added: trunk/src/components/openniServer/myprogeo.h
===================================================================
--- trunk/src/components/openniServer/myprogeo.h	                        (rev 0)
+++ trunk/src/components/openniServer/myprogeo.h	2013-04-16 09:44:59 UTC (rev 901)
@@ -0,0 +1,62 @@
+/*
+*  Copyright (C) 1997-2011 JDERobot Developers Team
+ *
+ *  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 2 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 Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *   Authors : Francisco Miguel Rivas Montero <franciscomiguel.rivas en urjc.es>
+ *             Jose María Cañas Plaza <jmplaza en gsyc.es>
+ *
+ */
+
+#ifndef OPENNISERVER_MYPROGEO_H
+#define OPENNISERVER_MYPROGEO_H
+
+#include <progeo/progeo.h>
+#include <iostream>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+/* GRAPHIC coordenates to OPTICAL coordenates */
+#define WORKING_IMG_HEIGHT 480
+#define GRAPHIC_TO_OPTICAL_X(x,y) (WORKING_IMG_HEIGHT-1-y)
+#define GRAPHIC_TO_OPTICAL_Y(x,y) (x)
+#define OPTICAL_TO_GRAPHIC_X(x,y) (y)
+#define OPTICAL_TO_GRAPHIC_Y(x,y) (WORKING_IMG_HEIGHT-1-x)
+
+#define MAX_CAMERAS 8
+#define MAX_BUFFER 1024
+
+namespace openniServer {
+  class myprogeo {
+	public:
+	myprogeo();
+	~myprogeo();
+	int load_cam_line(FILE *myfile,int cam);
+	void load_cam(char *fich_in,int cam, int w, int h);
+	void mybackproject(float x, float y, float* xp, float* yp, float* zp, float* camx, float* camy, float* camz, int cam);
+	void myproject(float x, float y, float z, float* xp, float* yp, int cam);
+	void mygetcameraposition(float *x, float *y, float *z, int cam);
+	void mygetcamerafoa(float *x, float *y, float *z, int cam);
+	void mygetcamerasize(float *w, float *h, int cam);
+	TPinHoleCamera getCamera(int camera);
+
+	private:
+		/* cameras */
+		TPinHoleCamera cameras[MAX_CAMERAS];
+  };
+} // namespace
+
+#endif /*KINECTVIEWER_MYPROGEO_H*/

Added: trunk/src/components/openniServer/openni2.cpp
===================================================================
--- trunk/src/components/openniServer/openni2.cpp	                        (rev 0)
+++ trunk/src/components/openniServer/openni2.cpp	2013-04-16 09:44:59 UTC (rev 901)
@@ -0,0 +1,113 @@
+/*****************************************************************************
+*                                                                            *
+*  OpenNI 2.x Alpha                                                          *
+*  Copyright (C) 2012 PrimeSense Ltd.                                        *
+*                                                                            *
+*  This file is part of OpenNI.                                              *
+*                                                                            *
+*  Licensed under the Apache License, Version 2.0 (the "License");           *
+*  you may not use this file except in compliance with the License.          *
+*  You may obtain a copy of the License at                                   *
+*                                                                            *
+*      http://www.apache.org/licenses/LICENSE-2.0                            *
+*                                                                            *
+*  Unless required by applicable law or agreed to in writing, software       *
+*  distributed under the License is distributed on an "AS IS" BASIS,         *
+*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  *
+*  See the License for the specific language governing permissions and       *
+*  limitations under the License.                                            *
+*                                                                            *
+*****************************************************************************/
+#include <OpenNI.h>
+
+
+
+int main(int argc, char** argv)
+{
+	int deviceID;
+	openni::Status rc = openni::STATUS_OK;
+
+	rc = openni::OpenNI::initialize();
+	if (rc != openni::STATUS_OK)
+	{
+		printf("%s: Initialize failed\n%s\n", argv[0], openni::OpenNI::getExtendedError());
+		return 1;
+	}
+
+	openni::Array<openni::DeviceInfo> deviceList;
+	openni::OpenNI::enumerateDevices(&deviceList);
+
+	const char* deviceUri;
+	//checking the number off connected devices
+	if (deviceList.getSize() < 1)
+	{
+		printf("Missing devices\n");
+		openni::OpenNI::shutdown();
+		return 1;
+	}
+	
+	//getting the Uri of the selected device
+	deviceUri = deviceList[deviceID].getUri();
+
+	//getting the device from the uri
+	openni::Device device;
+	openni::VideoStream depth;
+	rc = device.open(deviceUri);
+	if (rc != openni::STATUS_OK)
+	{
+		printf("%s: Couldn't open device %d\n%s\n", deviceID, deviceUri, openni::OpenNI::getExtendedError());
+		openni::OpenNI::shutdown();
+		return 3;
+	}
+
+
+/*
+
+	rc = depth1.create(device1, openni::SENSOR_DEPTH);
+	if (rc != openni::STATUS_OK)
+	{
+		printf("%s: Couldn't create stream %d on device %s\n%s\n", argv[0], openni::SENSOR_DEPTH, device1Uri, openni::OpenNI::getExtendedError());
+		openni::OpenNI::shutdown();
+		return 4;
+	}
+	rc = depth2.create(device2, openni::SENSOR_DEPTH);
+	if (rc != openni::STATUS_OK)
+	{
+		printf("%s: Couldn't create stream %d on device %s\n%s\n", argv[0], openni::SENSOR_DEPTH, device2Uri, openni::OpenNI::getExtendedError());
+		openni::OpenNI::shutdown();
+		return 4;
+	}
+
+	rc = depth1.start();
+	if (rc != openni::STATUS_OK)
+	{
+		printf("%s: Couldn't start stream %d on device %s\n%s\n", argv[0], openni::SENSOR_DEPTH, device1Uri, openni::OpenNI::getExtendedError());
+		openni::OpenNI::shutdown();
+		return 5;
+	}
+	rc = depth2.start();
+	if (rc != openni::STATUS_OK)
+	{
+		printf("%s: Couldn't start stream %d on device %s\n%s\n", argv[0], openni::SENSOR_DEPTH, device2Uri, openni::OpenNI::getExtendedError());
+		openni::OpenNI::shutdown();
+		return 5;
+	}
+
+	if (!depth1.isValid() && !depth2.isValid())
+	{
+		printf("SimpleViewer: No valid streams. Exiting\n");
+		openni::OpenNI::shutdown();
+		return 6;
+	}*/
+
+	/*SampleViewer sampleViewer("Simple Viewer", depth1, depth2);
+
+	rc = sampleViewer.init(argc, argv);
+	if (rc != openni::STATUS_OK)
+	{
+		printf("SimpleViewer: Initialization failed\n%s\n", openni::OpenNI::getExtendedError());
+		openni::OpenNI::shutdown();
+		return 7;
+	}
+	sampleViewer.run();*/
+}

Added: trunk/src/components/openniServer/openniServer.cfg
===================================================================
--- trunk/src/components/openniServer/openniServer.cfg	                        (rev 0)
+++ trunk/src/components/openniServer/openniServer.cfg	2013-04-16 09:44:59 UTC (rev 901)
@@ -0,0 +1,31 @@
+#without registry
+openniServer.Endpoints=default -h 0.0.0.0 -p 9998
+#with registry
+#cameras configuration
+openniServer.NCameras=1
+openniServer.PlayerDetection=1
+openniServer.Width=320
+openniServer.Height=240
+openniServer.fps=25
+
+#camera 1
+openniServer.deviceId=0
+openniServer.CameraRGB.Name=cameraA
+openniServer.CameraRGB.Format=RGB8
+openniServer.CameraRGB.fps=10
+openniServer.CameraRGB.PlayerDetection=0
+
+#openniServer.calibration=./config/camRGB
+openniServer.CameraDEPTH.Name=cameraB
+openniServer.CameraDEPTH.Format=RGB8
+openniServer.CameraDEPTH.fps=10
+openniServer.CameraDEPTH.PlayerDetection=0
+
+
+#Other components
+openniServer.CameraRGB=1
+openniServer.CameraDEPTH=1
+openniServer.pointCloudActive=1
+openniServer.pointCloud.Fps=10
+openniServer.Pose3DMotorsActive=0
+openniServer.KinectLedsActive=0

Added: trunk/src/components/openniServer/openniServer.cpp
===================================================================
--- trunk/src/components/openniServer/openniServer.cpp	                        (rev 0)
+++ trunk/src/components/openniServer/openniServer.cpp	2013-04-16 09:44:59 UTC (rev 901)
@@ -0,0 +1,1234 @@
+/*
+ *  Copyright (C) 1997-2012 JDE Developers Teameldercare.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/.
+ *
+ *  Authors : Jose María Cañas <jmplaza en gsyc.es>
+			Francisco Miguel Rivas Montero <franciscomiguel.rivas en urjc.es>
+			
+ */
+
+/** \file openniServer.cpp
+ * \brief openniServer component main file
+ */
+
+#include <Ice/Ice.h>
+#include <IceUtil/IceUtil.h>
+#include <gbxsickacfr/gbxiceutilacfr/safethread.h>
+#include <jderobot/kinectleds.h>
+#include <jderobot/camera.h>
+#include <jderobot/pose3dmotors.h>
+#include <jderobot/pointcloud.h>
+#include <colorspaces/colorspacesmm.h>
+#include <jderobotice/component.h>
+#include <jderobotice/application.h>
+#include <tr1/memory>
+#include <list>
+#include <sstream>
+#include <jderobotice/exceptions.h>
+#include <math.h>
+#include <cv.h>
+#include <highgui.h>
+#include <boost/thread/thread.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
+#include "myprogeo.h"
+#include <OpenNI.h>
+
+
+#ifdef WITH_NITE2
+	#include "NiTE.h"
+#endif
+
+
+#define VID_MICROSOFT 0x45e
+#define PID_NUI_MOTOR 0x02b0
+#define NUM_THREADS 5
+
+#define CHECK_RC(rc, what)                                      \
+if (rc != openni::STATUS_OK)                                         \
+{                                                               \
+    printf("%s failed: %s\n", what, openni::OpenNI::getExtendedError());     \
+                                                    \
+}
+
+openni::VideoFrameRef		m_depthFrame;
+openni::VideoFrameRef		m_colorFrame;
+openni::Device			m_device;
+
+
+#ifdef WITH_NITE2
+	nite::UserTracker* m_pUserTracker;
+	nite::UserTrackerFrameRef userTrackerFrame;
+	nite::Status rcN;
+#endif
+
+
+
+namespace openniServer{
+
+pthread_mutex_t mutex;
+int SELCAM;
+std::vector<int> distances;
+std::vector<int> pixelsID;
+cv::Mat* srcRGB;
+int colors[10][3];
+int userGeneratorActive=0;
+int m_width;
+int m_height;
+openni::VideoStream depth, color;
+openni::VideoStream** m_streams;
+
+int configWidth;
+int configHeight;
+int configFps;
+
+
+
+void* updateThread(void*)
+{
+	openni::Status rc = openni::STATUS_OK;
+	rc = openni::OpenNI::initialize();
+	if (rc != openni::STATUS_OK)
+	{
+		printf("%d: Initialize failed\n%s\n", SELCAM, openni::OpenNI::getExtendedError());
+	}
+
+	openni::Array<openni::DeviceInfo> deviceList;
+	openni::OpenNI::enumerateDevices(&deviceList);
+
+	const char* deviceUri;
+	//checking the number off connected devices
+	if (deviceList.getSize() < 1)
+	{
+		printf("Missing devices\n");
+		openni::OpenNI::shutdown();
+		//return 1;
+	}
+
+	//getting the Uri of the selected device
+	deviceUri = deviceList[SELCAM].getUri();
+
+	//getting the device from the uri
+	openni::VideoStream depth;
+	rc = m_device.open(deviceUri);
+	if (rc != openni::STATUS_OK)
+	{
+		printf("%d: Couldn't open device %s\n%s\n", SELCAM, deviceUri, openni::OpenNI::getExtendedError());
+		openni::OpenNI::shutdown();
+		//return 3;
+	}
+
+	//NITE
+	#ifdef WITH_NITE2
+	m_pUserTracker = new nite::UserTracker;
+	nite::NiTE::initialize();
+
+	if (m_pUserTracker->create(&m_device) != nite::STATUS_OK)
+	{
+		std::cout << "OpenniServer: Couldn't create userTracker " << std::endl;
+		//return openni::STATUS_ERROR;
+	}
+	#endif
+
+
+	
+	m_device.setImageRegistrationMode( openni::IMAGE_REGISTRATION_DEPTH_TO_COLOR );
+	//m_device.Device::setDepthColorSyncEnabled(true);
+
+	//depth
+	rc = depth.create(m_device, openni::SENSOR_DEPTH);
+	if (rc == openni::STATUS_OK)
+	{
+		rc = depth.start();
+		if (rc != openni::STATUS_OK)
+		{
+			printf("OpenniServer: Couldn't start depth stream:\n%s\n", openni::OpenNI::getExtendedError());
+			depth.destroy();
+		}
+	}
+	else
+	{
+		printf("OpenniServer: Couldn't find depth stream:\n%s\n", openni::OpenNI::getExtendedError());
+	}
+
+	//color
+	rc = color.create(m_device, openni::SENSOR_COLOR);
+	if (rc == openni::STATUS_OK)
+	{
+		rc = color.start();
+		if (rc != openni::STATUS_OK)
+		{
+			printf("OpenniServer: Couldn't start color stream:\n%s\n", openni::OpenNI::getExtendedError());
+			color.destroy();
+		}
+	}
+	else
+	{
+		printf("OpenniServer: Couldn't find color stream:\n%s\n", openni::OpenNI::getExtendedError());
+	}
+
+	openni::VideoMode depthVideoMode;
+	openni::VideoMode colorVideoMode;
+
+
+
+	colorVideoMode.setResolution(configWidth,configHeight);
+	colorVideoMode.setFps( configFps );
+	colorVideoMode.setPixelFormat( openni::PIXEL_FORMAT_RGB888 );
+	color.setVideoMode(colorVideoMode);
+	depthVideoMode.setResolution(configWidth,configHeight);
+	depthVideoMode.setFps( configFps );
+	depthVideoMode.setPixelFormat( openni::PIXEL_FORMAT_DEPTH_1_MM );
+	depth.setVideoMode(depthVideoMode);
+
+
+	if (depth.isValid() && color.isValid())
+	{
+		depthVideoMode = depth.getVideoMode();
+		colorVideoMode = color.getVideoMode();
+
+		int depthWidth = depthVideoMode.getResolutionX();
+		int depthHeight = depthVideoMode.getResolutionY();
+		int colorWidth = colorVideoMode.getResolutionX();
+		int colorHeight = colorVideoMode.getResolutionY();
+
+		if (depthWidth == colorWidth &&
+			depthHeight == colorHeight)
+		{
+			m_width = depthWidth;
+			m_height = depthHeight;
+		}
+		else
+		{
+			printf("Error - expect color and depth to be in same resolution: D: %dx%d, C: %dx%d\n",
+				depthWidth, depthHeight,
+				colorWidth, colorHeight);
+		}
+	}
+	else if (depth.isValid())
+	{
+		depthVideoMode = depth.getVideoMode();
+		m_width = depthVideoMode.getResolutionX();
+		m_height = depthVideoMode.getResolutionY();
+	}
+	else if (color.isValid())
+	{
+		colorVideoMode = color.getVideoMode();
+		m_width = colorVideoMode.getResolutionX();
+		m_height = colorVideoMode.getResolutionY();
+	}
+	else
+	{
+		printf("Error - expects at least one of the streams to be valid...\n");
+	}
+	
+	distances.resize(m_width*m_height);
+	pixelsID.resize(m_width*m_height);
+
+	m_streams = new openni::VideoStream*[2];
+	m_streams[0] = &depth;
+	m_streams[1] = &color;
+	
+
+	depth.setMirroringEnabled(false);
+	color.setMirroringEnabled(true);
+
+	
+	while(1){
+		pthread_mutex_lock(&mutex);
+		int changedIndex;
+
+		openni::Status rc = openni::OpenNI::waitForAnyStream(m_streams, 2, &changedIndex);
+		#ifndef WITH_NITE2
+		if (rc != openni::STATUS_OK)
+		{
+			printf("Wait failed\n");
+		}
+
+		switch (changedIndex)
+		{
+		case 0:
+			depth.readFrame(&m_depthFrame); break;
+		case 1:
+			color.readFrame(&m_colorFrame); break;
+		default:
+			printf("Error in wait\n");
+		}
+		//nite
+		#else
+		color.readFrame(&m_colorFrame);
+		rcN = m_pUserTracker->readFrame(&userTrackerFrame);
+		m_depthFrame = userTrackerFrame.getDepthFrame();
+		if (rcN != nite::STATUS_OK)
+		{
+			printf("GetNextData failed\n");
+			//return;
+		}
+		#endif
+
+
+
+
+		pthread_mutex_unlock(&mutex);
+		//OJO it control
+		usleep(1000);
+   }
+   
+}
+
+
+
+/**
+* \brief Class wich contains all the functions and variables to make run the Robot Cameras
+*/
+	class CameraRGB: virtual public jderobot::Camera {
+public:
+	CameraRGB(std::string& propertyPrefix, const jderobotice::Context& context)
+      : prefix(propertyPrefix),context(context),
+	imageFmt(),
+	imageDescription(new jderobot::ImageDescription()),
+	cameraDescription(new jderobot::CameraDescription()),
+	replyTask()
+	{
+	Ice::PropertiesPtr prop = context.properties();
+
+	//fill cameraDescription
+	cameraDescription->name = prop->getProperty(prefix+"Name");
+	if (cameraDescription->name.size() == 0)
+	throw 
+		jderobotice::ConfigFileException(ERROR_INFO,"Camera name not configured");
+
+	cameraDescription->shortDescription = prop->getProperty(prefix+"ShortDescription");
+
+	//fill imageDescription
+	imageDescription->width = configWidth;
+	imageDescription->height = configHeight;
+	int playerdetection = prop->getPropertyAsIntWithDefault(prefix+"PlayerDetection",0);
+	#ifndef WITH_NITE2
+		playerdetection=0;
+	#endif
+	int fps = prop->getPropertyAsIntWithDefault(prefix+"fps",5);
+	//we use formats acording to colorspaces
+	std::string fmtStr = prop->getPropertyWithDefault(prefix+"Format","YUY2");//default format YUY2
+	imageFmt = colorspaces::Image::Format::searchFormat(fmtStr);
+	if (!imageFmt)
+	throw 
+		jderobotice::ConfigFileException(ERROR_INFO, "Format " + fmtStr + " unknown");
+	imageDescription->size = imageDescription->width * imageDescription->height * CV_ELEM_SIZE(imageFmt->cvType);
+	imageDescription->format = imageFmt->name;
+
+	context.tracer().info("Starting thread for camera: " + cameraDescription->name);
+	replyTask = new ReplyTask(this, imageDescription->width, imageDescription->height,fps, playerdetection);
+
+	replyTask->start();//my own thread
+	}
+
+	virtual ~CameraRGB(){
+		context.tracer().info("Stopping and joining thread for camera: " + cameraDescription->name);
+		gbxiceutilacfr::stopAndJoin(replyTask);
+	}
+    
+	virtual jderobot::ImageDescriptionPtr getImageDescription(const Ice::Current& c){
+		return imageDescription;
+	}
+
+	virtual jderobot::CameraDescriptionPtr getCameraDescription(const Ice::Current& c){
+		return cameraDescription;
+	}
+
+	virtual void getImageData_async(const jderobot::AMD_ImageProvider_getImageDataPtr& cb,const Ice::Current& c){
+		replyTask->pushJob(cb);
+	}
+
+	virtual std::string startCameraStreaming(const Ice::Current&){
+		context.tracer().info("Should be made anything to start camera streaming: " + cameraDescription->name);
+	}
+
+	virtual void stopCameraStreaming(const Ice::Current&) {
+		context.tracer().info("Should be made anything to stop camera streaming: " + cameraDescription->name);
+	}
+
+	virtual Ice::Int setCameraDescription(const jderobot::CameraDescriptionPtr&, const Ice::Current&){
+		
+	}
+
+private:
+	class ReplyTask: public gbxiceutilacfr::SafeThread{
+	public:
+		ReplyTask(CameraRGB* camera, int width, int height, int fps, int playerdetection)
+	: gbxiceutilacfr::SafeThread(camera->context.tracer()), mycameravga(camera) {
+		segmentation=playerdetection;
+		this->fps=fps;
+      }
+		
+
+	void pushJob(const jderobot::AMD_ImageProvider_getImageDataPtr& cb){
+		IceUtil::Mutex::Lock sync(requestsMutex);
+		requests.push_back(cb);
+	}
+
+    virtual void walk(){
+
+		jderobot::ImageDataPtr reply(new jderobot::ImageData);
+		reply->description = mycameravga->imageDescription;
+		reply->pixelData.resize(mycameravga->imageDescription->width*mycameravga->imageDescription->height*3);
+		srcRGB = new cv::Mat(cv::Size(mycameravga->imageDescription->width,mycameravga->imageDescription->height),CV_8UC3);
+		cv::Mat dst_resize;
+
+
+		struct timeval a, b;
+		int cycle; // duración del ciclo
+		long totala;
+		long totalpre=0;
+		long diff;
+
+		cycle=(float)(1/(float)fps)*1000000;
+		
+	
+		while(!isStopping()){
+			gettimeofday(&a,NULL);
+			totala=a.tv_sec*1000000+a.tv_usec;
+			pthread_mutex_lock(&mutex);
+		    IceUtil::Time t = IceUtil::Time::now();
+		    reply->timeStamp.seconds = (long)t.toSeconds();
+		    reply->timeStamp.useconds = (long)t.toMicroSeconds() - reply->timeStamp.seconds*1000000;
+
+			if (!m_colorFrame.isValid()){
+				pthread_mutex_unlock(&mutex);			
+				continue;
+			}
+
+			//nite
+			#ifdef WITH_NITE2
+			const nite::UserMap& userLabels = userTrackerFrame.getUserMap();
+			const nite::UserId* pLabels = userLabels.getPixels();
+			#endif
+
+			const openni::RGB888Pixel* pImageRow = (const openni::RGB888Pixel*)m_colorFrame.getData();
+			int rowSize = m_colorFrame.getStrideInBytes() / sizeof(openni::RGB888Pixel);
+
+			for (int y = 0; y < m_colorFrame.getHeight(); ++y)
+			{
+				const openni::RGB888Pixel* pImage = pImageRow;
+				for (int x = 0; x < m_colorFrame.getWidth(); ++x, ++pImage)
+				{
+					#ifdef WITH_NITE2
+					if (segmentation){
+						pixelsID[(y*m_colorFrame.getWidth() + x)]= *pLabels;
+						if (*pLabels!=0)
+		                {
+		                    srcRGB->data[(y*m_colorFrame.getWidth() + x)*3 + 0] = colors[*pLabels][0];
+							srcRGB->data[(y*m_colorFrame.getWidth() + x)*3 + 1] = colors[*pLabels][1];
+							srcRGB->data[(y*m_colorFrame.getWidth() + x)*3 + 2] = colors[*pLabels][2];
+						}
+						else{
+							srcRGB->data[(y*m_colorFrame.getWidth() + x)*3 + 0] = 0;
+							srcRGB->data[(y*m_colorFrame.getWidth() + x)*3 + 1] = 0;
+							srcRGB->data[(y*m_colorFrame.getWidth() + x)*3 + 2] = 0;
+						}
+						++pLabels;
+					}
+					else{
+						srcRGB->data[(y*m_colorFrame.getWidth() + x)*3 + 0] = pImage->r;
+						srcRGB->data[(y*m_colorFrame.getWidth() + x)*3 + 1] = pImage->g;
+						srcRGB->data[(y*m_colorFrame.getWidth() + x)*3 + 2] = pImage->b;
+					}
+					#else
+						srcRGB->data[(y*m_colorFrame.getWidth() + x)*3 + 0] = pImage->r;
+						srcRGB->data[(y*m_colorFrame.getWidth() + x)*3 + 1] = pImage->g;
+						srcRGB->data[(y*m_colorFrame.getWidth() + x)*3 + 2] = pImage->b;
+					#endif
+				}
+				pImageRow += rowSize;
+			}	
+	
+
+			//test
+			//CalculateJoints();
+
+			
+			//cvFlip(srcRGB, NULL, 1);
+			//std::cout << "camara:" <<  (int)mycameravga->imageDescription->width << "x" << (int) mycameravga->imageDescription->height << std::endl;
+			//std::cout << "xtion: " <<  m_colorFrame.getWidth() << "x" << m_colorFrame.getHeight() << std::endl;
+
+			if ((mycameravga->imageDescription->width != m_colorFrame.getWidth()) || (mycameravga->imageDescription->height != m_colorFrame.getHeight())){
+				std::cout << "Assuming kinect device with resampled on device not working" << std::endl;
+				resize(*srcRGB, dst_resize, srcRGB->size(), 0, 0, cv::INTER_LINEAR);
+				memcpy(&(reply->pixelData[0]),(unsigned char *) dst_resize.data,dst_resize.cols*dst_resize.rows * 3);
+			}
+			else{
+				memcpy(&(reply->pixelData[0]),(unsigned char *) srcRGB->data,srcRGB->rows*srcRGB->cols * 3);
+			}
+
+		    {//critical region start
+			IceUtil::Mutex::Lock sync(requestsMutex);
+		    while(!requests.empty()){
+				jderobot::AMD_ImageProvider_getImageDataPtr cb = requests.front();
+				requests.pop_front();
+				cb->ice_response(reply);
+			}
+
+			}//critical region end
+
+			pthread_mutex_unlock(&mutex);
+			/*gettimeofday(&b,NULL);
+			totalb=b.tv_sec*1000000+b.tv_usec;*/
+			if (totalpre !=0){
+				if ((totala - totalpre) > cycle ){
+					std::cout<<"-------- openniServer: WARNING- RGB timeout-" << std::endl; 
+				}
+				else{
+					usleep(cycle - (totala - totalpre));
+				}
+			}
+			/*if (totalpre !=0){
+				std::cout << "rgb: " <<  1000000/(totala-totalpre) << std::endl;
+			}*/
+			totalpre=totala;
+		}
+	}
+	
+	CameraRGB* mycameravga;
+	IceUtil::Mutex requestsMutex;
+	std::list<jderobot::AMD_ImageProvider_getImageDataPtr> requests;
+	unsigned int m_nTexMapX;
+	unsigned int m_nTexMapY;
+	int m_width;
+	int	m_height;
+	openni::RGB888Pixel* m_pTexMap;
+	int segmentation;
+	int fps;
+	
+    };
+    typedef IceUtil::Handle<ReplyTask> ReplyTaskPtr;
+
+
+    std::string prefix;
+	jderobotice::Context context;
+    colorspaces::Image::FormatPtr imageFmt;
+    jderobot::ImageDescriptionPtr imageDescription;
+    jderobot::CameraDescriptionPtr cameraDescription;
+    ReplyTaskPtr replyTask;
+
+
+  };
+
+
+//*********************************************************************/
+	class CameraDEPTH: virtual public jderobot::Camera {
+public:
+	CameraDEPTH(std::string& propertyPrefix, const jderobotice::Context& context)
+      : prefix(propertyPrefix),context(context),
+	imageFmt(),
+	imageDescription(new jderobot::ImageDescription()),
+	cameraDescription(new jderobot::CameraDescription()),
+	replyTask()
+	{
+      
+      
+	Ice::PropertiesPtr prop = context.properties();
+
+	//fill cameraDescription
+	cameraDescription->name = prop->getProperty(prefix+"Name");
+	if (cameraDescription->name.size() == 0)
+	throw 
+		jderobotice::ConfigFileException(ERROR_INFO,"Camera name not configured");
+
+	cameraDescription->shortDescription = prop->getProperty(prefix+"ShortDescription");
+
+	//fill imageDescription
+	imageDescription->width = configWidth;
+	int playerdetection = prop->getPropertyAsIntWithDefault(prefix+"PlayerDetection",0);
+	#ifndef WITH_NITE2
+		playerdetection=0;
+	#endif
+	imageDescription->height = configHeight;
+	int fps = prop->getPropertyAsIntWithDefault(prefix+"fps",5);
+	//we use formats acording to colorspaces
+	std::string fmtStr = prop->getPropertyWithDefault(prefix+"Format","YUY2");//default format YUY2
+	imageFmt = colorspaces::Image::Format::searchFormat(fmtStr);
+	if (!imageFmt)
+	throw 
+		jderobotice::ConfigFileException(ERROR_INFO, "Format " + fmtStr + " unknown");
+	imageDescription->size = imageDescription->width * imageDescription->height * CV_ELEM_SIZE(imageFmt->cvType);
+	imageDescription->format = imageFmt->name;
+
+	context.tracer().info("Starting thread for camera: " + cameraDescription->name);
+	replyTask = new ReplyTask(this, imageDescription->width, imageDescription->height,fps, playerdetection);
+
+	replyTask->start();//my own thread
+	}
+
+	virtual ~CameraDEPTH(){
+		context.tracer().info("Stopping and joining thread for camera: " + cameraDescription->name);
+		gbxiceutilacfr::stopAndJoin(replyTask);
+	}
+    
+	virtual jderobot::ImageDescriptionPtr getImageDescription(const Ice::Current& c){
+		return imageDescription;
+	}
+
+	virtual jderobot::CameraDescriptionPtr getCameraDescription(const Ice::Current& c){
+		return cameraDescription;
+	}
+
+	virtual void getImageData_async(const jderobot::AMD_ImageProvider_getImageDataPtr& cb,const Ice::Current& c){
+		replyTask->pushJob(cb);
+	}
+
+	virtual std::string startCameraStreaming(const Ice::Current&){
+		context.tracer().info("Should be made anything to start camera streaming: " + cameraDescription->name);
+	}
+
+	virtual void stopCameraStreaming(const Ice::Current&) {
+		context.tracer().info("Should be made anything to stop camera streaming: " + cameraDescription->name);
+	}
+	
+	virtual Ice::Int setCameraDescription(const jderobot::CameraDescriptionPtr&, const Ice::Current&){
+		
+	}
+
+private:
+	class ReplyTask: public gbxiceutilacfr::SafeThread{
+	public:
+		ReplyTask(CameraDEPTH* camera, int width, int height, int fps, int playerDetection)
+	: gbxiceutilacfr::SafeThread(camera->context.tracer()), mycameradepth(camera) {
+		segmentation=playerDetection;
+		this->fps=fps;
+      }
+		
+
+	void pushJob(const jderobot::AMD_ImageProvider_getImageDataPtr& cb){
+		IceUtil::Mutex::Lock sync(requestsMutex);
+		requests.push_back(cb);
+	}
+
+    virtual void walk(){
+		int test;
+		
+
+		jderobot::ImageDataPtr reply(new jderobot::ImageData);
+		reply->description = mycameradepth->imageDescription;
+		reply->pixelData.resize(mycameradepth->imageDescription->width*mycameradepth->imageDescription->height*3);
+		cv::Mat dst_resize(cv::Size(mycameradepth->imageDescription->width, mycameradepth->imageDescription->height),CV_8UC3);
+		cv::Mat src(cv::Size(mycameradepth->imageDescription->width, mycameradepth->imageDescription->height),CV_8UC3);
+
+		struct timeval a, b;
+		int cycle; // duración del ciclo
+		long totalb,totala;
+		long totalpre=0;
+		long diff;
+
+		//std::cout << "FPS depth: " << fps << std::endl;
+		cycle=(float)(1/(float)fps)*1000000;
+
+
+		
+	
+		while(!isStopping()){
+			gettimeofday(&a,NULL);
+			totala=a.tv_sec*1000000+a.tv_usec;
+			pthread_mutex_lock(&mutex);
+			src=cv::Scalar(0, 0, 0);
+
+		    IceUtil::Time t = IceUtil::Time::now();
+		    reply->timeStamp.seconds = (long)t.toSeconds();
+		    reply->timeStamp.useconds = (long)t.toMicroSeconds() - reply->timeStamp.seconds*1000000;
+			if (!m_depthFrame.isValid()){
+				pthread_mutex_unlock(&mutex);			
+				continue;
+			}
+
+			//cvZero(src);
+
+			//nite
+			#ifdef WITH_NITE2
+			const nite::UserMap& userLabels = userTrackerFrame.getUserMap();
+			const nite::UserId* pLabels = userLabels.getPixels();
+			#endif
+
+			const openni::DepthPixel* pDepth = (const openni::DepthPixel*)m_depthFrame.getData();
+			int restOfRow = m_depthFrame.getStrideInBytes() / sizeof(openni::DepthPixel) - m_depthFrame.getWidth();
+
+			for (int y = 0; y < m_depthFrame.getHeight(); ++y)
+			{	
+				for (int x = 0; x < m_depthFrame.getWidth(); ++x, ++pDepth)
+				{
+					#ifdef WITH_NITE2
+					if ((*pLabels!=0)||(!segmentation)){
+						distances[(y*m_depthFrame.getWidth() + x)] = *pDepth;
+						if (*pDepth != 0)
+						{
+	        				int pval = (int)*pDepth/10; 
+							int lb = pval & 0xff;
+							switch (pval>>8) {
+							case 0:
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+0] = (unsigned int)255;
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+1] = (unsigned int)(255-lb);
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+2] = (unsigned int)(255-lb);
+								break;
+							case 1:
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+0] = (unsigned int)255;
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+1] = (unsigned int)lb;
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+2] = (unsigned int)0;
+								break;
+							case 2:
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+0] = (unsigned int)(255-lb);
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+1] = (unsigned int)255;
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+2] = (unsigned int)0;
+								break;
+							case 3:
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+0] = (unsigned int)0;
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+1] = (unsigned int)255;
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+2] = (unsigned int)lb;
+								break;
+							case 4:
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+0] = (unsigned int)0;
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+1] = (unsigned int)(255-lb);
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+2] = (unsigned int)255;
+								break;
+							case 5:
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+0] = (unsigned int)0;
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+1] = (unsigned int)0;
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+2] = (unsigned int)(255-lb);
+								break;
+							default:
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+0] = (unsigned int)0;
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+1] = (unsigned int)0;
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+2] = (unsigned int)0;
+								break;
+							}
+						}
+						else{
+							src.data[(y*m_depthFrame.getWidth()+ x)*3+0] = 0;
+							src.data[(y*m_depthFrame.getWidth()+ x)*3+1] = 0;
+							src.data[(y*m_depthFrame.getWidth()+ x)*3+2] = 0;
+						}
+					}
+					else{
+						src.data[(y*m_depthFrame.getWidth()+ x)*3+0] = 0;
+						src.data[(y*m_depthFrame.getWidth()+ x)*3+1] = 0;
+						src.data[(y*m_depthFrame.getWidth()+ x)*3+2] = 0;
+					}
+					++pLabels;
+					#else
+						distances[(y*m_depthFrame.getWidth() + x)] = *pDepth;
+						if (*pDepth != 0)
+						{
+	        				int pval = (int)*pDepth/10; 
+							int lb = pval & 0xff;
+							switch (pval>>8) {
+							case 0:
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+0] = (unsigned int)255;
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+1] = (unsigned int)(255-lb);
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+2] = (unsigned int)(255-lb);
+								break;
+							case 1:
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+0] = (unsigned int)255;
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+1] = (unsigned int)lb;
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+2] = (unsigned int)0;
+								break;
+							case 2:
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+0] = (unsigned int)(255-lb);
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+1] = (unsigned int)255;
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+2] = (unsigned int)0;
+								break;
+							case 3:
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+0] = (unsigned int)0;
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+1] = (unsigned int)255;
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+2] = (unsigned int)lb;
+								break;
+							case 4:
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+0] = (unsigned int)0;
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+1] = (unsigned int)(255-lb);
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+2] = (unsigned int)255;
+								break;
+							case 5:
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+0] = (unsigned int)0;
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+1] = (unsigned int)0;
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+2] = (unsigned int)(255-lb);
+								break;
+							default:
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+0] = (unsigned int)0;
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+1] = (unsigned int)0;
+								src.data[(y*m_depthFrame.getWidth()+ x)*3+2] = (unsigned int)0;
+								break;
+							}
+					}
+					#endif
+				}
+				pDepth += restOfRow;
+			}
+
+		   if ((mycameradepth->imageDescription->width != m_depthFrame.getWidth()) || (mycameradepth->imageDescription->height != m_depthFrame.getHeight())){
+				//cv::resize(src,dst_resize);
+				cv::resize(src, dst_resize, dst_resize.size(), 0, 0, cv::INTER_LINEAR);
+				std::cout << "resize depth" << std::endl;
+				memcpy(&(reply->pixelData[0]),(unsigned char *) dst_resize.data,dst_resize.cols*dst_resize.rows * 3);
+			}
+			else{
+				memcpy(&(reply->pixelData[0]),(unsigned char *) src.data,src.cols*src.rows * 3);
+			}
+		    
+		    {//critical region start
+			IceUtil::Mutex::Lock sync(requestsMutex);
+		    while(!requests.empty()){
+				jderobot::AMD_ImageProvider_getImageDataPtr cb = requests.front();
+				requests.pop_front();
+				cb->ice_response(reply);
+			}
+			}//critical region end
+			pthread_mutex_unlock(&mutex);
+			/*gettimeofday(&b,NULL);
+			totalb=b.tv_sec*1000000+b.tv_usec;*/
+			if (totalpre !=0){
+				if ((totala - totalpre) > cycle ){
+					std::cout<<"-------- openniServer: WARNING- DEPTH timeout-" << std::endl; 
+				}
+				else{
+					usleep(cycle - (totala-totalpre));
+				}
+			}
+			/*if (totalpre !=0){
+				std::cout << "depth: " <<  1000000/(totala-totalpre) << std::endl;
+			}*/
+			totalpre=totala;
+			
+		}
+	}
+	
+	CameraDEPTH* mycameradepth;
+	IceUtil::Mutex requestsMutex;
+	std::list<jderobot::AMD_ImageProvider_getImageDataPtr> requests;
+	
+
+	int segmentation;
+	int fps;
+	
+	
+    };
+    typedef IceUtil::Handle<ReplyTask> ReplyTaskPtr;
+
+
+    std::string prefix;
+    jderobotice::Context context;
+    colorspaces::Image::FormatPtr imageFmt;
+    jderobot::ImageDescriptionPtr imageDescription;
+    jderobot::CameraDescriptionPtr cameraDescription;
+    ReplyTaskPtr replyTask;
+
+  };
+
+/**
+* \brief Class wich contains all the functions and variables to serve point cloud interface
+*/
+
+	class pointCloudI: virtual public jderobot::pointCloud{
+		public:
+			pointCloudI (std::string& propertyPrefix, const jderobotice::Context& context):
+				prefix(propertyPrefix),context(context),data(new jderobot::pointCloudData()) {
+					Ice::PropertiesPtr prop = context.properties();
+
+					int playerdetection = prop->getPropertyAsIntWithDefault("openniServer.PlayerDetection",0);
+					int fps =prop->getPropertyAsIntWithDefault("openniServer.pointCloud.Fps",10);
+					#ifndef WITH_NITE2
+						playerdetection=0;
+					#endif
+					   replyCloud = new ReplyCloud(this,prop->getProperty("openniServer.calibration"), playerdetection, configWidth, configHeight,fps);
+					   replyCloud->start();
+				}
+		
+
+		virtual jderobot::pointCloudDataPtr getCloudData(const Ice::Current&){
+				data=replyCloud->getCloud();
+				return data;
+			};
+		   
+		   private:
+			 class ReplyCloud :public gbxiceutilacfr::SafeThread{ 
+		       public: 
+		       	ReplyCloud (pointCloudI* pcloud, std::string filepath,  int playerDetection, int widthIn, int heightIn, int fpsIn) : gbxiceutilacfr::SafeThread(pcloud->context.tracer()), data(new jderobot::pointCloudData()), data2(new jderobot::pointCloudData())
+		        	{
+					path=filepath;
+					segmentation=playerDetection;
+					cWidth = widthIn;
+					cHeight = heightIn;
+					fps=fpsIn;
+				}
+		       
+		        void walk()
+		        {
+				mypro= new openniServer::myprogeo();
+				mypro->load_cam((char*)path.c_str(),0, cWidth, cHeight);
+				
+				struct timeval a, b;
+				int cycle; // duración del ciclo
+				long totala;
+				long totalpre=0;
+
+				cycle=(float)(1/(float)fps)*1000000;
+
+				while(!isStopping()){
+					float distance;
+					gettimeofday(&a,NULL);
+					totala=a.tv_sec*1000000+a.tv_usec;
+					pthread_mutex_lock(&mutex);
+					data2->p.clear();
+					for( unsigned int i = 0 ; (i < cWidth*cHeight)&&(distances.size()>0); i=i+9) {
+							distance=(float)distances[i];
+							if (distance!=0){
+								//if (((unsigned char)srcRGB->data[3*i]!=0) && ((unsigned char)srcRGB->data[3*i+1]!=0) && ((unsigned char)srcRGB->data[3*i+2]!=0)){
+									float xp,yp,zp,camx,camy,camz;
+									float ux,uy,uz; 
+									float x,y;
+									float k;
+									float c1x, c1y, c1z;
+									float fx,fy,fz;
+									float fmod;
+									float t;
+									float Fx,Fy,Fz;
+				
+									mypro->mybackproject(i % cWidth, i / cWidth, &xp, &yp, &zp, &camx, &camy, &camz,0);
+				
+									//vector unitario
+									float modulo;
+				
+									modulo = sqrt(1/(((camx-xp)*(camx-xp))+((camy-yp)*(camy-yp))+((camz-zp)*(camz-zp))));
+									mypro->mygetcamerafoa(&c1x, &c1y, &c1z, 0);
+	
+									fmod = sqrt(1/(((camx-c1x)*(camx-c1x))+((camy-c1y)*(camy-c1y))+((camz-c1z)*(camz-c1z))));
+									fx = (c1x - camx)*fmod;
+									fy = (c1y - camy)*fmod;
+									fz = (c1z - camz) * fmod;
+									ux = (xp-camx)*modulo;
+									uy = (yp-camy)*modulo;
+									uz = (zp-camz)*modulo;
+									Fx= distance*fx + camx;
+									Fy= distance*fy + camy;
+									Fz= distance*fz + camz;
+									// calculamos el punto real 
+									t = (-(fx*camx) + (fx*Fx) - (fy*camy) + (fy*Fy) - (fz*camz) + (fz*Fz))/((fx*ux) + (fy*uy) + (fz*uz));
+									auxP.x=t*ux + camx;
+									auxP.y=t*uy+ camy;
+									auxP.z=t*uz + camz;
+									if ( segmentation){
+										auxP.id=pixelsID[i];
+									}
+									auxP.r=(float)(int) (unsigned char)srcRGB->data[3*i];
+									auxP.g=(float)(int) (unsigned char)srcRGB->data[3*i+1];
+									auxP.b=(float)(int) (unsigned char)srcRGB->data[3*i+2];
+									data2->p.push_back(auxP);
+								}
+							//}
+						}
+					pthread_mutex_unlock(&mutex);
+					if (totalpre !=0){
+						if ((totala - totalpre) > cycle ){
+							std::cout<<"-------- openniServer: WARNING- POINTCLOUD timeout-" << std::endl; 
+						}
+						else{
+							usleep(cycle - (totala - totalpre));
+						}
+					}
+					/*if (totalpre !=0){
+						std::cout << "cloud: " <<  1000000/(totala-totalpre) << std::endl;
+					}*/
+					totalpre=totala;
+				}
+		        }
+		        myprogeo *mypro;
+				int cWidth;
+				int cHeight;
+				int fps;
+				jderobot::pointCloudDataPtr data, data2;
+				jderobot::RGBPoint auxP;
+				std::string path;
+				int segmentation;
+		        
+		       jderobot::pointCloudDataPtr getCloud()
+		       {
+		          pthread_mutex_lock(&mutex);
+				data->p=data2->p;
+				pthread_mutex_unlock(&mutex);
+		          return data;
+		       }
+				
+		      
+		    	};	
+
+			typedef IceUtil::Handle<ReplyCloud> ReplyCloudPtr;
+			ReplyCloudPtr replyCloud;
+			std::string prefix;
+			jderobotice::Context context;
+			jderobot::pointCloudDataPtr data;
+			
+			
+		};
+
+
+
+
+/**
+* \brief Class wich contains all the functions and variables to controle the Pose3DMotors module
+*/
+/*class Pose3DMotorsI: virtual public jderobot::Pose3DMotors {
+	public:
+		Pose3DMotorsI(XN_USB_DEV_HANDLE* d, std::string& propertyPrefix, const jderobotice::Context& context): prefix(propertyPrefix),context(context),Pose3DMotorsData(new jderobot::Pose3DMotorsData()), Pose3DMotorsParams(new jderobot::Pose3DMotorsParams())
+		{
+			Ice::PropertiesPtr prop = context.properties();
+			Pose3DMotorsData->tilt=0;
+			Pose3DMotorsData->tiltSpeed=0;
+			rc= XN_STATUS_OK;
+			dev=d;
+			rc=xnUSBSendControl( *dev, XN_USB_CONTROL_TYPE_VENDOR, 0x06, 1, 0x00, NULL, 0, 0 );
+			CHECK_RC(rc,"led");
+     	}
+
+		virtual ~Pose3DMotorsI(){};
+
+		virtual  Ice::Int setPose3DMotorsData(const jderobot::Pose3DMotorsDataPtr& p, const Ice::Current&){
+			Pose3DMotorsData=p;
+			uint8_t empty[0x1];
+			//int angle = 25 * 2;
+			rc = xnUSBSendControl(*dev, XN_USB_CONTROL_TYPE_VENDOR, 0x31, (XnUInt16)p->tilt, 0x0, empty, 0x0, 0);
+			CHECK_RC(rc,"Changing angle");
+
+		};
+	
+		virtual jderobot::Pose3DMotorsParamsPtr getPose3DMotorsParams(const Ice::Current&){
+			return Pose3DMotorsParams;
+		};
+
+		virtual jderobot::Pose3DMotorsDataPtr getPose3DMotorsData (const Ice::Current&){
+			return Pose3DMotorsData;
+		};
+
+	private:
+		std::string prefix;
+		jderobotice::Context context;
+		jderobot::Pose3DMotorsDataPtr Pose3DMotorsData;
+		jderobot::Pose3DMotorsParamsPtr Pose3DMotorsParams;
+		XnStatus rc;
+		XN_USB_DEV_HANDLE* dev;
+    };*/
+
+/**
+* \brief Class wich contains all the functions and variables to controle the KinectLeds module
+*/
+/*class KinectLedsI: virtual public jderobot::KinectLeds {
+	public:
+		KinectLedsI(XN_USB_DEV_HANDLE* d, std::string& propertyPrefix, const jderobotice::Context& context): prefix(propertyPrefix),context(context)
+		{
+			Ice::PropertiesPtr prop = context.properties();
+			dev=d;
+     	}
+
+		virtual ~KinectLedsI(){};
+
+		virtual  void setLedActive(jderobot::KinectLedsAvailable led, const Ice::Current&){
+			int iled;
+			if (led==jderobot::OFF)
+				iled=0;
+			if (led==jderobot::GREEN)
+				iled=1;
+			if (led==jderobot::RED)
+				iled=2;
+			if (led==jderobot::YELLOW)
+				iled=3;
+			if (led==jderobot::BLINKYELLOW)
+				iled=4;
+			if (led==jderobot::BLINKGREEN)
+				iled=5;
+			if (led==jderobot::BLINKRED)
+				iled=6;
+			uint8_t empty[0x1];
+			rc = xnUSBSendControl(*dev, XN_USB_CONTROL_TYPE_VENDOR, 0x6, iled, 0x0, empty, 0x0, 0);
+			CHECK_RC(rc,"Changing led");
+		}
+
+	private:
+		std::string prefix;
+		jderobotice::Context context;
+		XN_USB_DEV_HANDLE* dev;
+    };*/
+
+/**
+* \brief Main Class of the component wich create the diferents devices activated using the Ice configuration file.
+*/
+class Component: public jderobotice::Component{
+public:
+	Component()
+	:jderobotice::Component("openniServer"){}
+
+	virtual void start(){
+		Ice::PropertiesPtr prop = context().properties();
+		int cameraR = prop->getPropertyAsIntWithDefault(context().tag() + ".CameraRGB",0);
+		int cameraD = prop->getPropertyAsIntWithDefault(context().tag() + ".CameraDEPTH",0);
+		int motors = prop->getPropertyAsIntWithDefault(context().tag() + ".Pose3DMotorsActive",0);
+		int leds = prop->getPropertyAsIntWithDefault(context().tag() + ".KinectLedsActive",0);
+		int pointCloud = prop->getPropertyAsIntWithDefault(context().tag() + ".pointCloudActive",0);
+		int playerdetection = prop->getPropertyAsIntWithDefault(context().tag() + ".PlayerDetection",0);
+		configWidth=prop->getPropertyAsIntWithDefault("openniServer.Width", 320);
+		configHeight=prop->getPropertyAsIntWithDefault("openniServer.Height",240);
+		configFps=prop->getPropertyAsIntWithDefault("openniServer.Fps",30);
+		
+		
+
+		SELCAM = prop->getPropertyAsIntWithDefault(context().tag() + ".deviceId",0);
+		std::cout << "Selected device: " << SELCAM << std::endl;
+		int nCameras=0;
+
+
+		/*COLORS*/
+		colors[0][0]=0;
+		colors[0][1]=0;
+		colors[0][2]=255;
+		colors[1][0]=0;
+		colors[1][1]=255;
+		colors[1][2]=255;
+		colors[2][0]=255;
+		colors[2][1]=255;
+		colors[2][2]=0;
+		colors[3][0]=255;
+		colors[3][1]=0;
+		colors[3][2]=0;
+		colors[4][0]=0;
+		colors[4][1]=255;
+		colors[4][2]=0;
+		colors[5][0]=255;
+		colors[5][1]=255;
+		colors[5][2]=0;
+		colors[6][0]=0;
+		colors[6][1]=0;
+		colors[6][2]=0;
+		colors[7][0]=150;
+		colors[7][1]=150;
+		colors[7][2]=0;
+		colors[8][0]=150;
+		colors[8][1]=150;
+		colors[8][2]=150;
+		colors[9][0]=0;
+		colors[9][1]=150;
+		colors[9][2]=150;
+
+		nCameras=cameraR + cameraD;
+		//g_context =  new xn::Context;
+		std::cout << "NCAMERAS = " << nCameras << std::endl;
+		cameras.resize(nCameras);
+		pthread_mutex_init(&mutex, NULL);
+		if ((nCameras>0)||(pointCloud)){
+			
+
+			pthread_create(&threads[0], NULL, &openniServer::updateThread, NULL);
+
+		}
+
+		if ((motors) || (leds)){
+			/*const XnUSBConnectionString *paths; 
+			XnUInt32 count; 
+			std::cout << "inicializo el dispositivo" << std::endl;
+			rc = xnUSBInit();
+			CHECK_RC(rc, "USB Initialization") ;
+			//rc = xnUSBOpenDevice(VID_MICROSOFT, PID_NUI_MOTOR, NULL, NULL, &dev);
+			CHECK_RC(rc,"Openning Device");
+			rc = xnUSBEnumerateDevices(VID_MICROSOFT, PID_NUI_MOTOR, &paths, &count);
+             	CHECK_RC(rc,"xnUSBEnumerateDevices failed");
+
+
+	        	// Open first found device
+        		rc = xnUSBOpenDeviceByPath(paths[SELCAM], &dev);
+	        	CHECK_RC(rc,"xnUSBOpenDeviceByPath failed");*/
+		}
+
+		if (cameraR){
+			std::string objPrefix(context().tag() + ".CameraRGB.");
+			std::string cameraName = prop->getProperty(objPrefix + "Name");
+			if (cameraName.size() == 0){//no name specified, we create one using the index
+				cameraName = "cameraR";
+				prop->setProperty(objPrefix + "Name",cameraName);//set the value
+				}
+			context().tracer().info("Creating camera " + cameraName);
+			cameras[0] = new CameraRGB(objPrefix,context());
+			context().createInterfaceWithString(cameras[0],cameraName);
+			std::cout<<"              -------- openniServer: Component: CameraRGB created successfully   --------" << std::endl;
+		}
+		if (cameraD){
+			std::string objPrefix(context().tag() + ".CameraDEPTH.");
+			std::string cameraName = prop->getProperty(objPrefix + "Name");
+			if (cameraName.size() == 0){//no name specified, we create one using the index
+				cameraName = "cameraD";
+				prop->setProperty(objPrefix + "Name",cameraName);//set the value
+				}
+			context().tracer().info("Creating camera " + cameraName);
+			cameras[1] = new CameraDEPTH(objPrefix,context());
+			context().createInterfaceWithString(cameras[1],cameraName);
+			//test camera ok
+			std::cout<<"              -------- openniServer: Component: CameraDEPTH created successfully   --------" << std::endl;
+		}
+		if (motors){
+			/*std::string objPrefix4="Pose3DMotors1";
+			std::string Pose3DMotorsName = "Pose3DMotors1";
+			context().tracer().info("Creating Pose3DMotors1 " + Pose3DMotorsName);
+			Pose3DMotors1 = new Pose3DMotorsI(&dev,objPrefix4,context());
+			context().createInterfaceWithString(Pose3DMotors1,Pose3DMotorsName);
+			std::cout<<"              -------- openniServer: Component: Pose3DMotors created successfully   --------" << std::endl;*/
+		}
+			
+		if (leds){
+			/*std::string objPrefix4="kinectleds1";
+			std::string Name = "kinectleds1";
+			context().tracer().info("Creating kinectleds1 " + Name);
+			kinectleds1 = new KinectLedsI(&dev,objPrefix4,context());
+			context().createInterfaceWithString(kinectleds1,Name);
+			std::cout<<"              -------- openniServer: Component: KinectLeds created successfully   --------" << std::endl;
+			*/
+		}
+		if (pointCloud){
+			std::string objPrefix5="pointcloud1";
+			std::string Name = "pointcloud1";
+			context().tracer().info("Creating pointcloud1 " + Name);
+			pointcloud1 = new pointCloudI(objPrefix5,context());
+			context().createInterfaceWithString(pointcloud1,Name);
+			std::cout<<"              -------- openniServer: Component: PointCloud created successfully   --------" << std::endl;
+		}
+
+		std::cout << "LISTOOOOOOOOOOOO" << std::endl;
+		sleep(50);
+    }
+
+    virtual ~Component(){
+    }
+
+  private:
+    std::vector<Ice::ObjectPtr> cameras;
+	Ice::ObjectPtr Pose3DMotors1;
+	Ice::ObjectPtr kinectleds1;
+	Ice::ObjectPtr pointcloud1;
+	pthread_t threads[NUM_THREADS];
+	//XN_USB_DEV_HANDLE dev;
+
+  };
+
+} //namespace
+
+int main(int argc, char** argv){
+
+  openniServer::Component component;
+
+	//usleep(1000);
+     jderobotice::Application app(component);
+
+     return app.jderobotMain(argc,argv);
+
+}

Modified: trunk/src/components/openniServer-kinect/CMakeLists.txt
===================================================================
--- trunk/src/components/openniServer-kinect/CMakeLists.txt	2013-04-16 08:45:20 UTC (rev 900)
+++ trunk/src/components/openniServer-kinect/CMakeLists.txt	2013-04-16 09:44:59 UTC (rev 901)
@@ -20,14 +20,12 @@
             ${LIBS_DIR}/jderobotice/libjderobotice.so
             ${LIBS_DIR}/jderobotutil/libjderobotutil.so
             ${LIBS_DIR}/progeo/libprogeo.so
-            ${LIBS_DIR}/pioneer/libpioneer.so
             ${LIBS_DIR}/colorspaces/libcolorspacesmm.so
             ${INTERFACES_CPP_DIR}/jderobot/libJderobotInterfaces.so
             ${Gearbox_LIBRARIES}
 	        ${ZeroCIce_LIBRARIES}
 	        ${openni_LIBRARIES}
 			${nite_LIBRARIES}
-	        ${pcl_LIBRARIES}
             ${opencv_LIBRARIES}
             ${gsl_LIBRARIES}
 #            ${gthread_LIBRARIES}



More information about the Jderobot-admin mailing list