<commit_before># IAI Kinect2

## Maintainer

- [<NAME>](https://ai.uni-bremen.de/team/thiemo_wiedemeyer) <<<EMAIL>>>, [Institute for Artificial Intelligence](http://ai.uni-bremen.de/), University of Bremen

## Description

This is a collection of tools and libraries for a ROS Interface to the Kinect One (Kinect v2).

It contains:
- [a calibration tool](https://github.com/code-iai/iai_kinect2/tree/master/kinect2_calibration) for calibrating the IR sensor of the Kinect One to the RGB sensor
- [a library](https://github.com/code-iai/iai_kinect2/tree/master/depth_registration) for depth registration with OpenCL support
- [the bridge](https://github.com/code-iai/iai_kinect2/tree/master/kinect2_bridge) between [libfreenect2](https://github.com/OpenKinect/libfreenect2) and [ROS](http://www.ros.org/)
- [a viewer](https://github.com/code-iai/iai_kinect2/tree/master/registration_viewer) for the images / point clouds

## Dependencies from all parts

- ROS Hydro/Indigo
- OpenCV
- PCL
- Eigen (optional)
- OpenCL (optional)
- [libfreenect2](https://github.com/OpenKinect/libfreenect2) or the iai_kinect2 branch of [my fork](https://github.com/wiedemeyer/libfreenect2/tree/iai_kinect2) which already includes the modifications

## Modifications to Upstream libfreenect2

[install_deps.sh](https://github.com/OpenKinect/libfreenect2/blob/master/depends/install_deps.sh):
- Replace [line 17](https://github.com/OpenKinect/libfreenect2/blob/master/depends/install_deps.sh#L17) with `./configure --prefix=$LIBUSB_INSTALL_DIR CFLAGS="$CFLAGS -fPIC"`

[CMakeLists.txt](https://github.com/OpenKinect/libfreenect2/blob/master/examples/protonect/CMakeLists.txt):
- Enable C++11 in [line 8](https://github.com/OpenKinect/libfreenect2/blob/master/examples/protonect/CMakeLists.txt#L8)
- Change [line 102](https://github.com/OpenKinect/libfreenect2/blob/master/examples/protonect/CMakeLists.txt#L102) from 'usb-1.0' to 'usb-1.0.a'
- Replace [line 51 to 57](https://github.com/OpenKinect/libfreenect2/blob/master/examples/protonect/CMakeLists.txt#L51-57) with

  ```
# GLEW
FIND_PACKAGE(GLEW REQUIRED)
INCLUDE_DIRECTORIES(${GLEW_INCLUDE_DIR})
```

## Install

1. Install the ROS. [Instructions for Ubuntu 14.04](http://wiki.ros.org/indigo/Installation/Ubuntu)
2. [Setup your ROS environment](http://wiki.ros.org/ROS/Tutorials/InstallingandConfiguringROSEnvironment)
3. Install [libfreenect2](https://github.com/OpenKinect/libfreenect2) with the described modifications or use [my fork](https://github.com/wiedemeyer/libfreenect2/tree/iai_kinect2) which includes the modifications:

   ```
cd ~
sudo apt-get install -y build-essential libturbojpeg libtool autoconf libudev-dev cmake mesa-common-dev freeglut3-dev libxrandr-dev doxygen libxi-dev libopencv-dev
sudo ln -s /usr/lib/x86_64-linux-gnu/libturbojpeg.so.0 /usr/lib/x86_64-linux-gnu/libturbojpeg.so
git clone https://github.com/wiedemeyer/libfreenect2.git
cd libfreenect2/depends
./install_ubuntu.sh
cd ../build
mkdir linux
cd linux
cmake ../../examples/protonect/
make && sudo make installsudo
```
4. Clone this repository into your catkin workspace, install the dependencies and build it:

   ```
git clone https://github.com/code-iai/iai_kinect2.git ~/catkin_ws/src/iai_kinect2
rosdep install -r depth_registration kinect2_bridge kinect2_calibration registration_viewer
cd ~/catkin_ws
catkin_make -DCMAKE_BUILD_TYPE="Release"
```
5. Connect your sensor and run `kinect2_bridge`:

   ```
rosrun kinect2_bridge kinect2_bridge
```
6. Calibrate your sensor using the `kinect2_calibration`. [Further details](https://github.com/code-iai/iai_kinect2/tree/master/kinect2_calibration#calibrating-the-kinect-one)
7. Add the calibration files to the `kinect2_bridge/data/<serialnumber>` folder. [Further details](https://github.com/code-iai/iai_kinect2/tree/master/kinect2_bridge#first-steps)
8. Restart `kinect2_bridge` and view the results using `rosrun registration_viewer viewer -kinect2 -cloud`.

## Permissions to access the Kinect One

To gain access to the Kinect One for non root users you have to add a rule to the udev rules.

1. Create a file named `90-kinect2.rules` in `/etc/udev/rules.d/`.
2. Write the following lines into that file:

  ```<commit_msg>small fix to README<commit_after># IAI Kinect2

## Maintainer

- [<NAME>](https://ai.uni-bremen.de/team/thiemo_wiedemeyer) <<<EMAIL>>>, [Institute for Artificial Intelligence](http://ai.uni-bremen.de/), University of Bremen

## Description

This is a collection of tools and libraries for a ROS Interface to the Kinect One (Kinect v2).

It contains:
- [a calibration tool](https://github.com/code-iai/iai_kinect2/tree/master/kinect2_calibration) for calibrating the IR sensor of the Kinect One to the RGB sensor
- [a library](https://github.com/code-iai/iai_kinect2/tree/master/depth_registration) for depth registration with OpenCL support
- [the bridge](https://github.com/code-iai/iai_kinect2/tree/master/kinect2_bridge) between [libfreenect2](https://github.com/OpenKinect/libfreenect2) and [ROS](http://www.ros.org/)
- [a viewer](https://github.com/code-iai/iai_kinect2/tree/master/registration_viewer) for the images / point clouds

## Dependencies from all parts

- ROS Hydro/Indigo
- OpenCV
- PCL
- Eigen (optional)
- OpenCL (optional)
- [libfreenect2](https://github.com/OpenKinect/libfreenect2) or the iai_kinect2 branch of [my fork](https://github.com/wiedemeyer/libfreenect2/tree/iai_kinect2) which already includes the modifications

## Modifications to Upstream libfreenect2

[install_deps.sh](https://github.com/OpenKinect/libfreenect2/blob/master/depends/install_deps.sh):
- Replace [line 17](https://github.com/OpenKinect/libfreenect2/blob/master/depends/install_deps.sh#L17) with `./configure --prefix=$LIBUSB_INSTALL_DIR CFLAGS="$CFLAGS -fPIC"`

[CMakeLists.txt](https://github.com/OpenKinect/libfreenect2/blob/master/examples/protonect/CMakeLists.txt):
- Enable C++11 in [line 8](https://github.com/OpenKinect/libfreenect2/blob/master/examples/protonect/CMakeLists.txt#L8)
- Change [line 102](https://github.com/OpenKinect/libfreenect2/blob/master/examples/protonect/CMakeLists.txt#L102) from 'usb-1.0' to 'usb-1.0.a'
- Replace [line 51 to 57](https://github.com/OpenKinect/libfreenect2/blob/master/examples/protonect/CMakeLists.txt#L51-57) with

  ```
# GLEW
FIND_PACKAGE(GLEW REQUIRED)
INCLUDE_DIRECTORIES(${GLEW_INCLUDE_DIR})
```

## Install

1. Install the ROS. [Instructions for Ubuntu 14.04](http://wiki.ros.org/indigo/Installation/Ubuntu)
2. [Setup your ROS environment](http://wiki.ros.org/ROS/Tutorials/InstallingandConfiguringROSEnvironment)
3. Install [libfreenect2](https://github.com/OpenKinect/libfreenect2) with the described modifications or use [my fork](https://github.com/wiedemeyer/libfreenect2/tree/iai_kinect2) which includes the modifications:

   ```
cd ~
sudo apt-get install -y build-essential libturbojpeg libtool autoconf libudev-dev cmake mesa-common-dev freeglut3-dev libxrandr-dev doxygen libxi-dev libopencv-dev
sudo ln -s /usr/lib/x86_64-linux-gnu/libturbojpeg.so.0 /usr/lib/x86_64-linux-gnu/libturbojpeg.so
git clone https://github.com/wiedemeyer/libfreenect2.git
cd libfreenect2/depends
./install_ubuntu.sh
cd ../build
mkdir linux
cd linux
cmake ../../examples/protonect/
make && sudo make install
```
4. Clone this repository into your catkin workspace, install the dependencies and build it:

   ```
git clone https://github.com/code-iai/iai_kinect2.git ~/catkin_ws/src/iai_kinect2
rosdep install -r depth_registration kinect2_bridge kinect2_calibration registration_viewer
cd ~/catkin_ws
catkin_make -DCMAKE_BUILD_TYPE="Release"
```
5. Connect your sensor and run `kinect2_bridge`:

   ```
rosrun kinect2_bridge kinect2_bridge
```
6. Calibrate your sensor using the `kinect2_calibration`. [Further details](https://github.com/code-iai/iai_kinect2/tree/master/kinect2_calibration#calibrating-the-kinect-one)
7. Add the calibration files to the `kinect2_bridge/data/<serialnumber>` folder. [Further details](https://github.com/code-iai/iai_kinect2/tree/master/kinect2_bridge#first-steps)
8. Restart `kinect2_bridge` and view the results using `rosrun registration_viewer viewer -kinect2 -cloud`.

## Permissions to access the Kinect One

To gain access to the Kinect One for non root users you have to add a rule to the udev rules.

1. Create a file named `90-kinect2.rules` in `/etc/udev/rules.d/`.
2. Write the following lines into that file:

  ```
{'fraction_non_alphanumeric': 0.12672372800760817, 'fraction_numerical': 0.02282453637660485, 'mean_word_length': 5.131924198250728, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 40, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2030234', 'n_tokens_mistral': 3233, 'n_tokens_neox': 3009, 'n_words': 635}