Table of Contents

RosKnect: ROS and Kinect on Raspberry Pi

Authors

Javier Acosta

Josselin Porras

Description

This project seeks to implement a Kinect for a computer network using free software.

The hardware used for this purpose includes: a Kinect, a Raspberry Pi ® and a computer. The Raspberry Pi ® will feature a suitable operating system and have installed ROS and libraries necessary to successfully integrate a Kinect, to it, the computer will work ideally with adequate of Debian version, besides ROS and rviz.

The following is a brief description of the different tools:

Objectives

General Objectives

Specific Objectives

Getting Started

Working on the PC

For this guide we can have to choose one way to install the core ROS packages, using apt-get or pip. In most of cases we are going to use apt-get, however we use pip for install rosintall-generator that make it easier for local installations using xstow.

Prerequisites

  $ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu wheezy main" > /etc/apt/sources.list.d/ros-latest.list'
  $ wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
Installing Dependencies

Remember up to date your Debian packages

  $ sudo apt-get update
  $ sudo apt-get install python-rosdep python-wstool build-essential checkinstall
Installing rosinstall-generator locally
  $ sudo apt-get install python-pip
  $ export PYTHONUSERBASE=${HOME}/local/DIR/rosinstall-generator-groovy
  $ pip install --user -U rosinstall_generator
  $ cd ~/local/DIR
  $ xstow rosinstall-generator-groovy

Note: For use xstow follow the tuturial here https://wiki.arcoslab.eie.ucr.ac.cr/doku.php?id=using_xstow_for_local_installations

Installing ROS

Building the catkin Packages
  $ mkdir ~/ros_catkin_ws
  $ cd ~/ros_catkin_ws
  $ rosinstall_generator desktop-full --rosdistro groovy --deps --wet-only > groovy-desktop-full-wet.rosinstall

Now we have groovy-desktop-full-wet.rosinstall file in our ros catkin workspace

  $ wstool init -j8 src groovy-desktop-full-wet.rosinstall

The last instruction make a src/ directory, that contains the core packages of ROS.

Resolving Dependencies

Installing Collada Dom

collada-dom-dev is a required dependency which is unfortunately not part of the Debian repositories. Follow the next steps to install it

  $ cd ~/local/src
  $ wget http://sourceforge.net/projects/collada-dom/files/latest/download
  $ tar -xf download
  $ cd collada-dom-2.4.0
  $ mkdir build
  $ ccmake ../ 
  $ make install
  $ sudo checkinstall make install

You may need to update the package name from “collada-dom” to “collada-dom-dev” otherwise the rosdep install may fail to find it.

Now, we can run rosdep to download and install all the others dependencies:

  $ rosdep install --from-paths src --ignore-src --rosdistro groovy -y -r

Building the catkin Workspace

We are going to build the catkin packages invoking catking_make_isolated. For this we will going to install it in the install_isolated folder, inside the catkin workspace:

  $ ./src/catkin/bin/catkin_make_isolated --install
  $ echo "source ~/ros_catkin_ws/install_isolated/setup.bash" >> ~/.bashrc

For some known issues consult http://wiki.ros.org/groovy/Installation/Debian

Now you have the catkin ROS packages built and sourced. If you need build the rosbuild packages visit http://wiki.ros.org/groovy/Installation/Source#Build_the_rosbuild_Packages

Working on the Pi

Installing OS Raspbian on Raspberry Pi

The community on the Raspberry Pi Wiki has written a guide for beginners on how to set up your SD card. Look this link: http://elinux.org/RPi_Easy_SD_Card_Setup

Create a swap (optional)

If your ram memory raspberry pi is not enough for your purposes, you can create a swap. It is recommended that the sd has capacity for 16 gb or more.

$ sudo swapoff /var/swap; sudo dd if=/dev/zero of=/var/swap bs=1024 count=2048k 
$ sudo mkswap /var/swap; sudo swapon /var/swap; sudo swapon -s
Installing ROS Groovy on Pi

To use this repository, use the following steps:

$ sudo sh -c 'echo "deb http://64.91.227.57/repos/rospbian wheezy main" > /etc/apt/sources.list.d/rospbian.list'
$ wget http://64.91.227.57/repos/rospbian.key -O - | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install ros-groovy-ros-comm
$ roscore
Installing the libraries for Microsoft Kinect (Freenect) and its dependencies
$ sudo apt-get install ros-groovy-camera-info-manager libpoco-dev ros-groovy-rosconsole-bridge ros-groovy-dynamic-reconfigure ros-groovy-diagnostic-updater ros-groovy-nodelet libfreenect-dev
$ source /opt/ros/hydro/setup.bash

Note: ROS suggest, add this line to .bashrc (~/.bashrc)

$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/src
$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/src

The catkin_make command is used to compile and work with packages catkin workspaces. If catkin_make works you should now have a 'build' and 'devel' folder in your current directory. Inside the 'devel' folder you have several setup.*sh files. Sourcing any of these files will overlay this workspace on top of your environment.

$ source devel/setup.bash

Note: use this line every time you compile any package or you want to use some library or package that is in this catkin workspace.

Add packages to workspace
$ cd ~/catkin_ws/src 
$ git clone https://github.com/ros-drivers/freenect_stack.git
$ cd ~/catkin_ws/src/freenect/freenect_camera/include/freenect_camera

If you look in your current directory you should now have a 'freenect_device.hpp', 'freenect_driver.hpp' and 'imag_buffer.hpp' files. In these files modify the lines:

     #include <libfreenect/libfreenect.h> >> #include <libfreenect.h>
     #include <libfreenect/libfreenect-registration.h> >> #include <libfreenect-registration.h>

Use catkin_make for compile and install the packages that are in the workspace catkin, ‘freenect’ and ‘rgbd_launch’.

$ cd ~/catkin_ws
$ catkin_make
$ search devel/setup.bash
$ roslauch freenect_launch freenect.lauch

Results

The installation of both Raspbian and Debian was successful on the Raspberry Pi.In the raspberry pi the Groovy ROS base installation was successful, roscore command was used to test the installation and other commands like rosls roscp and to check its correct operation. After installation of ROS, was installed Freenect, for it was used catkin_make command, this command libraries compiled and installed successfully, but when testing freenect_launch execution, there were some missing files errors, despite the library where they are, seem to be installed.

Great advance is achieved on the compilation and installation of the packages and libraries for ROS Groovy on the PC. However it cannot be totally completed, most of the errors are caused because the program does not find libraries and files that it needs to run. These errors were probably caused by wrong versions of software. The solution can be look the correct version of this and try asking to developers.

Conclusions

References

[1] http://wiki.ros.org/

[2] http://wiki.ros.org/kinect

[3] http://wiki.ros.org/ROSberryPi/Setting%20up%20ROS%20on%20RaspberryPi

[4] http://wiki.ros.org/rviz

[5] http://www.raspberrypi.org/

[6] http://www.raspberrypi.org/wp-content/uploads/2012/04/quick-start-guide-v2_1.pdf