Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package update to work with hydro with no user intervention #6

Open
wants to merge 1 commit into
base: hydro-devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 101 additions & 27 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,39 +1,113 @@
cmake_minimum_required(VERSION 2.8.3)
project(openni2_tracker)
find_package(catkin REQUIRED COMPONENTS geometry_msgs
orocos_kdl
find_package(catkin REQUIRED COMPONENTS
roscpp
roslib
tf)
# Find OpenNI2
#find_package(PkgConfig)
#pkg_check_modules(OpenNI2 REQUIRED libopenni2)
find_path(OpenNI2_INCLUDEDIR
NAMES OpenNI.h
HINTS /usr/include/openni2)
find_library(OpenNI2_LIBRARIES
NAMES OpenNI2 DummyDevice OniFile PS1090
HINTS /usr/lib/ /usr/lib/OpenNI2/Drivers
PATH_SUFFIXES lib)
message(STATUS ${OpenNI2_LIBRARIES})

# Find Nite2
message(status $ENV{NITE2_INCLUDE})
message(status $ENV{NITE2_REDIST64})
find_path(Nite2_INCLUDEDIR
NAMES NiTE.h
HINTS $ENV{NITE2_INCLUDE})
find_library(Nite2_LIBRARY
NAMES NiTE2
HINTS $ENV{NITE2_REDIST64}
PATH_SUFFIXES lib)
find_package(orocos_kdl REQUIRED)

catkin_package()

include_directories(${catkin_INCLUDEDIR}
${OpenNI2_INCLUDEDIR}
${Nite2_INCLUDEDIR})
include(ExternalProject)
## Check architecture 32 or 64 bit for precompiled OpenNI2 and NiTE2 Libraries
if (CMAKE_SIZEOF_VOID_P MATCHES "8")
ExternalProject_Add(
OpenNI2
PREFIX ${CMAKE_CURRENT_BINARY_DIR}
URL http://www.openni.ru/wp-content/uploads/2013/01/OpenNI-Linux-x64-2.1.0.tar.zip
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not acceptable in my opinion, it should be downloaded from the structure.io website or better yet OpenNI's GitHub:

URL_MD5 be1f12b964fe07f4a3243b946c6ce387
UPDATE_COMMAND tar -xf <SOURCE_DIR>/OpenNI-Linux-x64-2.1.0.tar.bz2
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
)
ExternalProject_Add(
NiTE2
PREFIX ${CMAKE_CURRENT_BINARY_DIR}
URL http://www.openni.ru/wp-content/uploads/NiTE-Linux-x64-2.0.0.tar.zip
URL_MD5 4244e25bebc87a15fc761b7371107494
UPDATE_COMMAND tar -xf <SOURCE_DIR>/NiTE-Linux-x64-2.0.0.tar.bz2
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
)

add_custom_target(OpenNI2_copy)
add_dependencies(OpenNI2_copy OpenNI2)
add_custom_command(TARGET OpenNI2_copy PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/src/OpenNI2/OpenNI-2.1.0-x64 ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_BIN_DESTINATION}/OpenNI-2.1.0-x64)

add_custom_target(NiTE2_copy)
add_dependencies(NiTE2_copy NiTE2)
add_custom_command(TARGET NiTE2_copy PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/src/NiTE2/NiTE-2.0.0 ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_BIN_DESTINATION}/NiTE-2.0.0)

add_custom_target(OpenNI2_conf_copy)
add_dependencies(OpenNI2_conf_copy OpenNI2)
add_custom_command(TARGET OpenNI2_conf_copy PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/src/OpenNI2/OpenNI-2.1.0-x64/Redist/OpenNI2 $ENV{HOME}/.ros/OpenNI2)

add_custom_target(NiTE2_conf_copy)
add_dependencies(NiTE2_conf_copy NiTE2)
add_custom_command(TARGET NiTE2_conf_copy PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/src/NiTE2/NiTE-2.0.0/Redist/NiTE2 $ENV{HOME}/.ros/NiTE2)

set(OpenNI2_INCLUDEDIR ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_BIN_DESTINATION}/OpenNI-2.1.0-x64/Include)
set(OpenNI2_LIBRARIES ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_BIN_DESTINATION}/OpenNI-2.1.0-x64/Redist/libOpenNI2.so
${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_BIN_DESTINATION}/OpenNI-2.1.0-x64/Redist/OpenNI2/Drivers/libPS1080.so
${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_BIN_DESTINATION}/OpenNI-2.1.0-x64/Redist/OpenNI2/Drivers/libOniFile.so)
set(Nite2_INCLUDEDIR ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_BIN_DESTINATION}/NiTE-2.0.0/Include)
set(Nite2_LIBRARY ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_BIN_DESTINATION}/NiTE-2.0.0/Redist/libNiTE2.so)
elseif (CMAKE_SIZEOF_VOID_P MATCHES "4")
ExternalProject_Add(
OpenNI2
PREFIX ${CMAKE_CURRENT_BINARY_DIR}
URL http://www.openni.ru/wp-content/uploads/2013/01/OpenNI-Linux-x86-2.1.0.tar.zip
URL_MD5 827b37db761b5885177d3e414cec7762
UPDATE_COMMAND tar -xf <SOURCE_DIR>/OpenNI-Linux-x86-2.1.0.tar.bz2
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
)
ExternalProject_Add(
NiTE2
PREFIX ${CMAKE_CURRENT_BINARY_DIR}
URL http://www.openni.ru/wp-content/uploads/NiTE-Linux-x86-2.0.0.tar.zip
URL_MD5 30d66a07447a73e5bcd8f28af6628606
UPDATE_COMMAND tar -xf <SOURCE_DIR>/NiTE-Linux-x86-2.0.0.tar.bz2
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
)

add_custom_target(OpenNI2_copy)
add_dependencies(OpenNI2_copy OpenNI2)
add_custom_command(TARGET OpenNI2_copy PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/src/OpenNI2/OpenNI-2.1.0-x86 ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_BIN_DESTINATION}/OpenNI-2.1.0-x86)

add_custom_target(NiTE2_copy)
add_dependencies(NiTE2_copy NiTE2)
add_custom_command(TARGET NiTE2_copy PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/src/NiTE2/NiTE-2.0.0 ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_BIN_DESTINATION}/NiTE-2.0.0)

add_custom_target(OpenNI2_conf_copy)
add_dependencies(OpenNI2_conf_copy OpenNI2)
add_custom_command(TARGET OpenNI2_conf_copy PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/src/OpenNI2/OpenNI-2.1.0-x86/Redist/OpenNI2 $ENV{HOME}/.ros/OpenNI2)

add_custom_target(NiTE2_conf_copy)
add_dependencies(NiTE2_conf_copy NiTE2)
add_custom_command(TARGET NiTE2_conf_copy PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/src/NiTE2/NiTE-2.0.0/Redist/NiTE2 $ENV{HOME}/.ros/NiTE2)

set(OpenNI2_INCLUDEDIR ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_BIN_DESTINATION}/OpenNI-2.1.0-x86/Include)
set(OpenNI2_LIBRARIES ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_BIN_DESTINATION}/OpenNI-2.1.0-x86/Redist/libOpenNI2.so
${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_BIN_DESTINATION}/OpenNI-2.1.0-x86/Redist/OpenNI2/Drivers/libPS1080.so
${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_BIN_DESTINATION}/OpenNI-2.1.0-x86/Redist/OpenNI2/Drivers/libOniFile.so)
set(Nite2_INCLUDEDIR ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_BIN_DESTINATION}/NiTE-2.0.0/Include)
set(Nite2_LIBRARY ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_BIN_DESTINATION}/NiTE-2.0.0/Redist/libNiTE2.so)
endif (CMAKE_SIZEOF_VOID_P MATCHES "8")

include_directories(${catkin_INCLUDEDIR} ${OpenNI2_INCLUDEDIR} ${Nite2_INCLUDEDIR})

add_executable(openni2_tracker src/openni2_tracker.cpp)
add_dependencies(openni2_tracker OpenNI2_copy NiTE2_copy OpenNI2_conf_copy NiTE2_conf_copy)
target_link_libraries(openni2_tracker ${catkin_LIBRARIES} ${OpenNI2_LIBRARIES} ${Nite2_LIBRARY})

install(TARGETS openni2_tracker RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
Expand Down
12 changes: 12 additions & 0 deletions launch/openni2_tracker.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<launch>
<arg name="tracker_name" default="tracker" />
<!-- Load the Tracker -->
<node name="openni2_tracker" pkg="openni2_tracker" type="openni2_tracker" >
<param name="tf_prefix" value="$(arg tracker_name)" />
<param name="relative_frame" value="/$(arg tracker_name)_depth_frame" />
</node>

<!-- TF Static Transforms to World -->
<node pkg="tf" type="static_transform_publisher" name="world_to_tracker" args=" 0 0 1.25 1.5707 0 1.7707 /world /$(arg tracker_name)_depth_frame 100"/>
</launch>
2 changes: 0 additions & 2 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

<build_depend>libopenni2-dev</build_depend>
<build_depend>libusb-1.0-dev</build_depend>
<!-- <build_depend>libopenni-nite-dev</build_depend> -->
<build_depend>libopenni-sensor-primesense-dev</build_depend> -->
<build_depend>geometry_msgs</build_depend>
<build_depend>orocos_kdl</build_depend>
Expand All @@ -24,7 +23,6 @@

<run_depend>libopenni2-dev</run_depend>
<run_depend>libusb-1.0-dev</run_depend>
<!-- <run_depend>libopenni-nite-dev</run_depend> -->
<run_depend>libopenni-sensor-primesense-dev</run_depend>
<run_depend>geometry_msgs</run_depend>
<run_depend>orocos_kdl</run_depend>
Expand Down
Loading