User Tools

Site Tools


Writing /var/lib/dokuwiki/data/meta/teaching/ie0117/proyectos/2013/ii/rosknect/ros_y_kinect_en_raspberry_pi.meta failed
teaching:ie0117:proyectos:2013:ii:rosknect:ros_y_kinect_en_raspberry_pi

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:

  • ROS: It is an open source program that provides libraries and tools to facilitate the creation of applications in robotics. Also provides drivers for devices, displays, and hardware abstraction and more.
  • Raspberry Pi®: is a credit-card-sized single-board computer developed in the UK by the Raspberry Pi Foundation with the intention of promoting the teaching of basic computer science in schools.
  • Kinect: A peripheral commonly used as a motion sensor, by which controllers have been developed that allow for operation under open platforms.
  • rviz: A 3D visualization tool for ROS.

Objectives

General Objectives

  • Implement a system to communicate by network a Kinect connected to a Raspberry Pi ® and a computer so that the computer can display the images captured by the Kinect.

Specific Objectives

  • Install an operating system on a Raspberry Pi®.
  • Consider various ROS distributions to determine which is most suitable to be implemented in the Raspberry Pi®.
  • Achieve the operation of the Kinect ® Raspberry Pi using different libraries that ROS has the these purposes.
  • Install Rviz and ROS on a computer.
  • Examine different tools in order to acquire a general knowledge of them that enable build this and other applications.

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

  • Configure Debian repositories
  $ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu wheezy main" > /etc/apt/sources.list.d/ros-latest.list'
  • Set up your keys:
  $ 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
  • Install the bootstrap dependencies and checkinstall:
  $ sudo apt-get install python-rosdep python-wstool build-essential checkinstall
Installing rosinstall-generator locally
  • Firs of all we have to install python-pip
  $ sudo apt-get install python-pip
  • Configure the local directory for python-pip installations
  $ 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
  • First you will need a catkin workspace
  $ mkdir ~/ros_catkin_ws
  $ cd ~/ros_catkin_ws
  • Getting .rosinstall file
  $ 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

  • We will want to fetch the core packages so we can build them. We will use wstool for this.
  $ 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 ../ 
  • Set the CMAKE_INSTALL_PREFIX to /home/user/local/DIR/collada
  • Press “c” and then “g”
  $ make install
  • Then run checkinstall
  $ 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
  • Create SD card setup

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

  • Turn on the raspberry pi and continue with the simple installation of your Raspberry Pi Raspbian
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:

  • Add the repository to your apt sources
$ sudo sh -c 'echo "deb http://64.91.227.57/repos/rospbian wheezy main" > /etc/apt/sources.list.d/rospbian.list'
  • Add the apt key
$ wget http://64.91.227.57/repos/rospbian.key -O - | sudo apt-key add -
  • Update apt sources
$ sudo apt-get update
  • Install ros packages, all the core ROS tools, so that they will all be installed
$ sudo apt-get install ros-groovy-ros-comm
  • Run roscore, for check installation
$ roscore
  • Stop roscore, ctrl+C
Installing the libraries for Microsoft Kinect (Freenect) and its dependencies
  • Install dependencies for freenect
$ 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
  • Create a Catkin workspace
$ source /opt/ros/hydro/setup.bash

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

  • Create the folders where you create the workspace
$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/src
  • Build a workspace empty (there are no packages in the 'src' folder, just a single CMakeLists.txt link)
$ 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
  • Add rgbd_launch (other freenect dependence). Copy rgbd_launch source in the 'src' folder.
$ cd ~/catkin_ws/src 
  • Copy freenect_stack source in the 'src' folder. Freenect_stack is a catkin metapackage include core packages, freenect_camera and freenect_launch.
$ 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
  • Anew, sourcing these files will overlay this workspace on top of your environment.
$ search devel/setup.bash
  • Run freenect, for check installation.
$ 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

  • ROS Groovy add many advantages over ROS Fuerte using the new Low-level build system macros and infrastructure for ROS named catkin.
  • The best way to compile and install packages and libraries is using local installations.
  • Xstow improves the management of packages, and provides the possibility to have several version of software.
  • It is recommended to create a 2 GB swap in the raspberry to increase capacity, as its 512 MB of RAM is insufficient for some functions of ROS and Raspbian.
  • ROS is a constantly evolving system, which causes that the packages in the repositories are changing frecuently, so the tutorials have many errors, which increase the difficult of ROS installation.

References

teaching/ie0117/proyectos/2013/ii/rosknect/ros_y_kinect_en_raspberry_pi.txt · Last modified: 2022/09/20 00:08 (external edit)