ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Assuming that ROS Groovy uses OpenNI v1.*, as I presume try, something along these lines:

pkg_check_modules (LIBUSB REQUIRED libusb-1.0)
include_directories (${LIBUSB_INCLUDE_DIRS})
link_directories (${LIBUSB_LIBRARY_DIRS})

FIND_PATH(OPEN_NI_INCLUDE "XnOpenNI.h" "OpenNIConfig.h" HINTS "$ENV{OPEN_NI_INCLUDE}" "/usr/include/ni" "/usr/include/openni" "/opt/ros/groovy/include/openni_camera")
FIND_LIBRARY(OPEN_NI_LIBRARY NAMES OpenNI libOpenNI HINTS $ENV{OPEN_NI_LIB} "/usr/lib")
LINK_DIRECTORIES($ENV{OPEN_NI_LIB})
INCLUDE_DIRECTORIES(${OPEN_NI_INCLUDE})
LINK_LIBRARIES(${OPEN_NI_LIBRARY})
FIND_PATH(XN_NITE_INCLUDE "libXnVNite.so" HINTS "$ENV{XN_NITE_INSTALL_PATH}" "/usr/include/nite")
FIND_LIBRARY(XN_NITE_LIBRARY NAMES libXnVNite_1_5_2.so HINTS $ENV{XN_NITE_INSTALL_PATH} "/usr/lib")
LINK_DIRECTORIES($ENV{XN_NITE_LIB_INSTALL_PATH} "/usr/lib")
INCLUDE_DIRECTORIES(${XN_NITE_INCLUDE})
LINK_LIBRARIES(${XN_NITE_LIBRARY})

target_link_libraries (your_project_name ${SSE_FLAGS} ${OPEN_NI_LIBRARIES} ${XN_NITE_LIBRARIES})

If, instead, you want to use a manually installed copy of OpenNI 2.* (not in ROS yet), please see (http://community.openni.org/openni/topics/cmake_configuration_files_for_openni "this discussion") for a starting CMakeLists.txt which solves some problems but not all. Disclaimer: this is a shameless link to a question related to OpenNI, CMake but not to ROS that I myself posted on the OpenNI forums.

Assuming that ROS Groovy uses OpenNI v1.*, as I presume try, (don't have an installation handy), try something along these lines:

pkg_check_modules (LIBUSB REQUIRED libusb-1.0)
include_directories (${LIBUSB_INCLUDE_DIRS})
link_directories (${LIBUSB_LIBRARY_DIRS})

FIND_PATH(OPEN_NI_INCLUDE "XnOpenNI.h" "OpenNIConfig.h" HINTS "$ENV{OPEN_NI_INCLUDE}" "/usr/include/ni" "/usr/include/openni" "/opt/ros/groovy/include/openni_camera")
FIND_LIBRARY(OPEN_NI_LIBRARY NAMES OpenNI libOpenNI HINTS $ENV{OPEN_NI_LIB} "/usr/lib")
LINK_DIRECTORIES($ENV{OPEN_NI_LIB})
INCLUDE_DIRECTORIES(${OPEN_NI_INCLUDE})
LINK_LIBRARIES(${OPEN_NI_LIBRARY})
FIND_PATH(XN_NITE_INCLUDE "libXnVNite.so" HINTS "$ENV{XN_NITE_INSTALL_PATH}" "/usr/include/nite")
FIND_LIBRARY(XN_NITE_LIBRARY NAMES libXnVNite_1_5_2.so HINTS $ENV{XN_NITE_INSTALL_PATH} "/usr/lib")
LINK_DIRECTORIES($ENV{XN_NITE_LIB_INSTALL_PATH} "/usr/lib")
INCLUDE_DIRECTORIES(${XN_NITE_INCLUDE})
LINK_LIBRARIES(${XN_NITE_LIBRARY})

target_link_libraries (your_project_name ${SSE_FLAGS} ${OPEN_NI_LIBRARIES} ${XN_NITE_LIBRARIES})

If, instead, you want to use a manually installed copy of OpenNI 2.* (not in ROS yet), please see (http://community.openni.org/openni/topics/cmake_configuration_files_for_openni "this discussion") for a starting CMakeLists.txt which solves some problems but not all. Disclaimer: this is a shameless link to a question related to OpenNI, CMake but not to ROS that I myself posted on the OpenNI forums.

Assuming that ROS Groovy uses OpenNI v1.*, as I presume (don't have an installation handy), try something along these lines:

pkg_check_modules (LIBUSB REQUIRED libusb-1.0)
include_directories (${LIBUSB_INCLUDE_DIRS})
link_directories (${LIBUSB_LIBRARY_DIRS})

FIND_PATH(OPEN_NI_INCLUDE "XnOpenNI.h" "OpenNIConfig.h" HINTS "$ENV{OPEN_NI_INCLUDE}" "/usr/include/ni" "/usr/include/openni" "/opt/ros/groovy/include/openni_camera")
FIND_LIBRARY(OPEN_NI_LIBRARY NAMES OpenNI libOpenNI HINTS $ENV{OPEN_NI_LIB} "/usr/lib")
LINK_DIRECTORIES($ENV{OPEN_NI_LIB})
INCLUDE_DIRECTORIES(${OPEN_NI_INCLUDE})
LINK_LIBRARIES(${OPEN_NI_LIBRARY})
FIND_PATH(XN_NITE_INCLUDE "libXnVNite.so" HINTS "$ENV{XN_NITE_INSTALL_PATH}" "/usr/include/nite")
FIND_LIBRARY(XN_NITE_LIBRARY NAMES libXnVNite_1_5_2.so HINTS $ENV{XN_NITE_INSTALL_PATH} "/usr/lib")
LINK_DIRECTORIES($ENV{XN_NITE_LIB_INSTALL_PATH} "/usr/lib")
INCLUDE_DIRECTORIES(${XN_NITE_INCLUDE})
LINK_LIBRARIES(${XN_NITE_LIBRARY})

target_link_libraries (your_project_name ${SSE_FLAGS} ${OPEN_NI_LIBRARIES} ${XN_NITE_LIBRARIES})

If, instead, you want to use a manually installed copy of OpenNI 2.* (not in ROS yet), please see (http://community.openni.org/openni/topics/cmake_configuration_files_for_openni "this discussion") this discussion for a starting CMakeLists.txt which solves some problems but not all. Disclaimer: this is a shameless link to a question related to OpenNI, CMake but not to ROS that I myself posted on the OpenNI forums.