Skip to content
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
4 changes: 0 additions & 4 deletions .gitignore

This file was deleted.

102 changes: 59 additions & 43 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,43 +1,59 @@
cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)

# Set the build type. Options are:
# Coverage : w/ debug symbols, w/o optimization, w/ code-coverage
# Debug : w/ debug symbols, w/o optimization
# Release : w/o debug symbols, w/ optimization
# RelWithDebInfo : w/ debug symbols, w/ optimization
# MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries
#set(ROS_BUILD_TYPE RelWithDebInfo)

rosbuild_init()

#set the default path for built executables to the "bin" directory
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#set the default path for built libraries to the "lib" directory
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

#uncomment if you have defined messages
rosbuild_genmsg()
#uncomment if you have defined services
#rosbuild_gensrv()

#common commands for building c++ executables and libraries
#rosbuild_add_library(${PROJECT_NAME} src/example.cpp)
#target_link_libraries(${PROJECT_NAME} another_library)
#rosbuild_add_boost_directories()
#rosbuild_link_boost(${PROJECT_NAME} thread)
#rosbuild_add_executable(example examples/example.cpp)
#target_link_libraries(example ${PROJECT_NAME})
# Change two lines below according to your installation
set(OPENNI2_DIR ~/dev/OpenNI2)
set(NITE2_DIR ~/dev/NiTE-Linux-x64-2.2/)
#set the default path for built executables to the "bin" directory
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#set the default path for built libraries to the "lib" directory
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
link_directories(${OPENNI2_DIR}/Bin/x64-Release)
include_directories(${OPENNI2_DIR}/Include)
link_directories(${NITE2_DIR}/Redist)
include_directories(${NITE2_DIR}/Include)
rosbuild_add_executable(tracker src/tracker.cpp)
target_link_libraries(tracker OpenNI2 NiTE2)
cmake_minimum_required(VERSION 3.5)
project(openni2_tracker)

add_compile_options(-std=c++11)

find_package(catkin REQUIRED COMPONENTS
geometry_msgs
std_msgs
roscpp
roslib
tf
tf2
message_generation)

include_directories(${catkin_INCLUDE_DIRS})

add_message_files(
FILES
TrackerUser.msg
TrackerUserArray.msg
)

generate_messages(
DEPENDENCIES
std_msgs
geometry_msgs
)

catkin_package(
CATKIN_DEPENDS roscpp std_msgs geometry_msgs message_runtime
)

# Find OpenNI2
find_path(OpenNI2_INCLUDE_DIR
NAMES OpenNI.h
HINTS /usr/local/include/OpenNI2)
find_library(OpenNI2_LIBRARIES
NAMES OpenNI2 DummyDevice libOniFile.so PS1090
HINTS /usr/lib/ /usr/local/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_INCLUDE_DIR
NAMES NiTE.h
HINTS /usr/local/include/NiTE-Linux-x64-2.2)
find_library(Nite2_LIBRARY
NAMES libNiTE2.so
HINTS /usr/local/bin}
PATH_SUFFIXES lib)

include_directories(${OpenNI2_INCLUDE_DIR}
${Nite2_INCLUDE_DIR})

add_executable(tracker src/tracker.cpp)
target_link_libraries(tracker ${catkin_LIBRARIES} ${OpenNI2_LIBRARIES} ${Nite2_LIBRARY})
add_dependencies(tracker openni2_tracker_generate_messages_cpp)
1 change: 0 additions & 1 deletion Makefile

This file was deleted.

111 changes: 74 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,104 @@
openni2_tracker
openni2-tracker
===============

`openni2_tracker` is a ROS Wrapper for the OpenNI2 and NiTE2 Skeleton Tracker. This is designed as a companion package to the `openni2_camera` package (found [here](https://github.com/ros-drivers/openni2_camera)). Currently, all this node does is publish TF frames of the current tracked user's joint locations. I will eventually be adding a user message similar to the old `openni_tracker` ROS package.
This work is developed from [here](https://github.com/futureneer/openni2-tracker), which is based on out-dated rosbuild system. I made it support catkin system, and write a more detailed README to make user can build their development environment step by step.

** Note: These instructions only been tested with the Primesense Carmine 1.08 tracker. There is a way to get this working with the Kinect, using the freenect drivers, but I have not tested that yet. There is information [here](https://github.com/ros-drivers/openni2_camera) on how to use freenect with OpenNI2.
### Installation
1. Clone the beta OpenNI2 repository from Github:
`openni2_tracker` is a ROS Wrapper for the OpenNI2 and NiTE2 Skeleton Tracker. This is designed as a companion package to the `openni2_camera` package (found [here](https://github.com/ros-drivers/openni2_camera)). Currently, all this node does is publish TF frames of the current tracked user's joint locations.

**Note**: These instructions only been tested with ASUS Xtion Pro Live in ROS-kinetic, Ubuntu 16.04. You can directly access to the **docker image** file which support all software development environment within OpenGL visualization at [here](https://cloud.docker.com/repository/docker/bluebirdpp/openni2/tags), or just run the following command to get the docker image:
```bash
docker pull bluebirdpp/openni2:latest
```

### Installation
1. Install OpenNI2:

```bash
git clone git@github.com:OpenNI/OpenNI2.git
sudo apt install git libusb-1.0-0-dev libudev-dev
sudo apt install openjdk-8-jdk # for xenial; openjdk-6-jdk for trusty; if not using other java version.
sudo apt install freeglut3-dev
cd # go home
mkdir -p src && cd src # create $HOME/src if it doesn't exist; then, enter it
git clone https://github.com/occipital/OpenNI2.git # We used to have a fork off 6857677beee08e264fc5aeecb1adf647a7d616ab with working copy of Xtion Pro Live OpenNI2 driver.
cd OpenNI2
make -j$(nproc) # compile
sudo ln -s $PWD/Bin/x64-Release/libOpenNI2.so /usr/local/lib/ # $PWD should be /yourPathTo/OpenNI2
sudo ln -s $PWD/Bin/x64-Release/OpenNI2/ /usr/local/lib/ # $PWD should be /yourPathTo/OpenNI2
sudo ln -s $PWD/Include /usr/local/include/OpenNI2 # $PWD should be /yourPathTo/OpenNI2
sudo ldconfig
```

Then, switch to the OpenNI2 directory and build:
2. Install ASUS Xtion Pro Live OpenNI driver:

```bash
cd OpenNI2
make
sudo apt install libopenni-sensor-primesense0
```

2. Install Nite2 from the OpenNI Website [here](http://www.openni.org/files/nite/?count=1&download=http://www.openni.org/wp-content/uploads/2013/10/NiTE-Linux-x64-2.2.tar1.zip). Be sure to match the version (x86 or x64) with the version of OpenNI2 you installed above.
You will probably need to create a free account.

Change directories to the NiTE location and install with

3. Install NiTE2.2:

```bash
cd NiTE-Linux-x64-2.2
sudo ./install.sh
cd # go home
mkdir -p src && cd src # create $HOME/src if it doesn't exist; then, enter it
wget https://sourceforge.net/projects/roboticslab/files/External/nite/NiTE-Linux-x64-2.2.tar.bz2
tar xvf NiTE-Linux-x64-2.2.tar.bz2
sudo ln -s $PWD/NiTE-Linux-x64-2.2/Redist/libNiTE2.so /usr/local/lib/ # $PWD should be /yourPathTo/NiTE-Linux-x64-2.2/..
sudo ln -s $PWD/NiTE-Linux-x64-2.2/Include /usr/local/include/NiTE-Linux-x64-2.2 # $PWD should be /yourPathTo/NiTE-Linux-x64-2.2/..
sudo ldconfig
```
Try and run one of the examples in `.../NiTE-Linux-x64-2.2/Samples/Bin/NiTE2`. If these don't work, then something went wrong with your installation.

3. Clone `openni2_tracker` to your ROS workspace.


To make sure your NiTE2.2 can run successfully, you need to run some NiTE built-in binary file:

```bash
git clone git@github.com:futureneer/openni2-tracker.git
cd ~/src/NiTE-Linux-x64-2.2/Samples/Bin
./UserViewer
```

4. Configure CMake
In the CMakeLists.txt file inside the `openni2_tracker` package, you will need to change the path where CMake will look for OpenNI2 and NiTE2. These two lines:
If you got a depth images stream, that means your NiTE work as expected. If you got "no device found" error, you may need to do this:

```makefile
set(OPENNI2_DIR ~/dev/OpenNI2)
set(NITE2_DIR ~/dev/NiTE-Linux-x64-2.2/)
```
need to point to the root directories of where you extracted or cloned OpenNI2 and NiTE2.
```bash
sudo ln -s /lib/x86_64-linux-gnu/libudev.so.1.6.4 /lib/x86_64-linux-gnu/libudev.so.0
````

4. Clone `openni2_tracker` to your ROS workspace:
```bash
cd ~/catkin_ws/src
git clone git@github.com:msr-peng/openni2_tracker.git
```

5. Configure CMake:

5. Make openni2_tracker
If you followed Step 1 and Step 2 **strictlly**, then you needn't do anything. Otherwise, you need to modify `CMakeList.txt` in `openni2_tracker` package to make your project can find OpenNI2 and NiTE2.2

6. Make openni2_tracker:

```bash
roscd openni2_tracker
rosmake
cd ~/catkin_ws
catkin_make
```

6. Set up NiTE2: Right now, NiTE requires that any executables point to a training sample directory at `.../NiTE-Linux-x64-2.2/Samples/Bin/NiTE2`. If you run the NiTE sample code, this works fine because those examples are in that same directory. However, to be able to roslaunch or rosrun openni2_tracker from any current directory, I have created a workaround script `setup_nite.bash`. This script creates a symbolic link of the NiTE2 directory in your .ros directory (the default working directory for roslaunch / rosrun). You will need to modify this file so that it points to YOUR NiTE2 and .ros locations. I would be pleased if anyone has a better solution to this.
7. Run openni2_tracker
7. Set up NiTE2:

Right now, NiTE requires that any executables point to a training sample directory at `.../NiTE-Linux-x64-2.2/Samples/Bin/NiTE2`. If you run the NiTE sample code, this works fine because those examples are in that same directory. However, to be able to roslaunch or rosrun openni2_tracker from any current directory, I have created a workaround script `setup_nite.bash`. This script creates a symbolic link of the NiTE2 directory in your .ros directory (the default working directory for roslaunch / rosrun). You will need to modify this file so that it points to YOUR NiTE2 and .ros locations.
By default, you need do this:
```bash
cd ~/catkin_ws/src/openni2_tracker
./setup_nite.bash
```
I would be pleased if anyone has a better solution to this.

8. Run openni2_tracker:

```bash
roslaunch openni2_tracker tracker.launch
```

Then you can visualize the skeleton tracking results on `Rviz`:

```bash
rosrun rviz rviz -f /tracker_depth_frame
```

Finally in `Rivz`, add `TF` to visualize the skeleton keypoints coordinates.

In the lauch file, you can rename both the tracker name and the tracker's relative frame. I have included a static publisher that aligns the tracker frame to the world frame, approximately 1.25m off the floor.

```xml
Expand All @@ -79,6 +119,3 @@ You will probably need to create a free account.
```

Currently, this node will broadcast TF frames of the joints of any user being tracked by the tracker. The frame names are based on the tracker name, currently `/tracker/user_x/joint_name`

### THANKS!
Please let me know if something doesnt work, or if you have suggestions (or feel free to add stuff and send a pull request).
14 changes: 0 additions & 14 deletions mainpage.dox

This file was deleted.

18 changes: 0 additions & 18 deletions manifest.xml

This file was deleted.

2 changes: 1 addition & 1 deletion setup_nite.bash
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash
ln -s ~/dev/NiTE-Linux-x64-2.2/Samples/Bin/NiTE2 ~/.ros/NiTE2
ln -s ~/src/NiTE-Linux-x64-2.2/Samples/Bin/NiTE2 ~/.ros/NiTE2
103 changes: 0 additions & 103 deletions src/main.cpp

This file was deleted.

Loading