Installing ROS Indigo on the Raspberry Pi
Description:this instruction covers the installation of ROS Indigo on the original Raspberry Pi with Raspbian.
Keywords:raspberry Pi, Setup, Indigo
Contents
1 Introduction
This tutorial explains how to install ROS Indigo from source on the Raspberry Pi. The instructions follow roughly the source installation of Indigo. However, a few dependencies need to being accounted for Raspbian.
Note:if you ' re using the-Raspberry Pi 2 You can use the standard ARM installation instructions here.
2 Prerequisites
These instructions assume that Raspbian are being used as the OS on the Raspberry Pi. The download page for current images of Raspbian is http://www.raspberrypi.org/downloads/.
2.1 Setup ROS repositories
Raspbian Jessie:
' echo "Deb Http://packages.ros.org/ros/ubuntu Jessie Main" >/etc/apt/sources.list.d/ros-latest.list ' $ wget https: // Raw.githubusercontent.com/ros/rosdistro/master/ros.key-o-| sudo apt-key add-
Now, make sure your the Debian package index is up-to-date:
$ sudo apt-get update$ sudo apt-get Upgrade
2.2 Install Bootstrap Dependencies
Raspbian Jessie:
$ sudo apt-get install Python-pip python-setuptools python-yaml python-distribute python-docutils Python-dateutil python-six$ sudo pip install rosdep rosinstall_generator wstool rosinstall
2.3 Initializing ROSDEP
$ sudo rosdep init$ rosdep update
3 Installation
Now, we'll download and build ROS Indigo.
3.1 Create a Catkin Workspace
In order to build the core packages, you'll need a Catkin workspace. Create one now:
$ mkdir ~/~/ros_ws
Next we'll want to fetch the core packages so we can build them. We'll use the wstool for this. Select the Wstool command for the particular variant of your want to install:
Ros-comm: (Recommended) ROS package, build, and communication libraries. No GUI Tools.
$ rosinstall_generator ros_comm--rosdistro Indigo--deps--wet-only--exclude roslisp--tar > indigo-ros_comm-wet . rosinstall$ wstool init src-ros_comm-wet.rosinstall
This would add all of the Catkin or wet packages in the given variant and then fetch the sources into THE~/ROS_WS/SRC Direc Tory. The command would take a few minutes to download all of the core ROS packages into the SRC folder. THE-J8 option downloads 8 packages in parallel.
Note:the Roslisp package are excluded in these generators because the dependency sbcl are not available in the Raspbian rep Ositories. Building SBCL from source may be possible and is not tested. So far, only these variants has been tested on the Raspberry Pi in Indigo; However, more is defined in REP 131such as robot, perception, etc. Just Change the package path to the one want, e.g., for robot do:
$ rosinstall_generator Robot--rosdistro Indigo--deps--wet-only--tar > indigo-robot-wet.rosinstall$ wstool init src Indigo-robot-wet.rosinstall
Please feel free to update these instructions as your test more variants.
If Wstool init fails or is interrupted, you can resume the download by running:
Wstool update-t src
3.2 Resolve Dependencies
Before you can build your Catkin workspace and you need to make sure so you have all the required dependencies. We Use the ROSDEP tool for this, however, a couple of dependencies is not available in the repositories. They must be manually built first.
3.2.1 Unavailable Dependencies
Following packages is not available for Raspbian:
Raspbian Wheezy:libconsole-bridge-dev, Liburdfdom-headers-dev, Liburdfdom-dev, Liblz4-dev,collada-dom-dev
Raspbian Jessie: Collada-dom-dev
The following packages is needed for each ROS variant:
Ros_comm: Libconsole-bridge-dev, Liblz4-dev
Desktop:libconsole-bridge-dev, Liblz4-dev, Liburdfdom-headers-dev, Liburdfdom-dev, Collada-dom-dev
The required packages can built from source in a NE W Directory:
$ mkdir ~/ros_ws/external_src$ sudo apt-get'echo ' DEB-SRC/HTTP/ Mirrordirector.raspbian.org/raspbian/testing Main contrib non-free RPI ">>/etc/apt/sources.list" $ sudo apt-get update
Libconsole-bridge-dev:
$ cd ~/ros_ws/external_src$ sudo apt-get build-dep console-bridge$ apt-get Source- b console--I. libconsole-bridge0. 2*.deb libconsole-bridge-dev_*.deb
Note:for Raspbian Jessie, just using the Apt-get Install command to install the Libconsole-bridge-dev package:
$ sudo apt-get Install Libconsole-bridge-dev
Liblz4-dev:
$ cd ~/ros_ws/external_src$ apt-get Source--I Liblz4-*.deb
Note:for Raspbian Jessie, just using the Apt-get Install command to install the Liblz4-dev package:
$ sudo apt-get Install Liblz4-dev
Liburdfdom-headers-dev:
$ cd ~/ros_ws/external_src$ git clone https://github.com/ros/urdfdom_headers.git$ cd urdfdom_headers$ cmake. $ sudo check Install make install
When Check-install asks-changes, the name (2) needs to change from "Urdfdom-headers" to "Liburdfdom-headers-dev" O Therwise the ROSDEP install wont find it.
Liburdfdom-dev:
$ cd ~/ros_ws/external_src$ sudo apt-get install Libboost-test-dev libtinyxml-dev$ git clone https://github.com/ros/ urdfdom.git$ CD urdfdom$ cmake. $ sudo checkinstall make install
When Check-install asks-changes, the name (2) needs to change from "Urdfdom" to "Liburdfdom-dev" otherwise the Ros DEP install wont find it.
Collada-dom-dev: (Note:you'll also need to patch COLLADA_URDF as described here):
$ cd ~/ros_ws/external_src$ sudo apt-get install libboost-filesystem-dev libxml2-dev$ wget/http/ downloads.sourceforge.net/project/collada-dom/collada%20dom/collada%20dom%202.4/collada-dom-2.4.0.tgz$ TAR-XZF collada-dom-2.4.0.tgz$ CD collada-dom-2.4.0$ cmake. $ sudo checkinstall make install
When Check-install asks-changes, the name (2) needs to change from "Collada-dom" to "Collada-dom-dev" otherwise th e rosdep install wont find it.
Note:if you don ' t want to compile Collada and would like-to-install the desktop variant, use the following generator:
$ rosinstall_generator Desktop--rosdistro Indigo--deps--wet-only--exclude roslisp collada_parser collada_urdf--tar &G T Indigo-desktop-wet.rosinstall
3.2.2 Resolving Dependencies with ROSDEP
The remaining dependencies should is resolved by running ROSDEP:
Raspbian Jessie:
$ cd ~/--from-paths src--ignore-src--rosdistro indigo-y-R--os=debian:jessie
this'll look at all of the packages in the SRC directory and find all of the Dependen Cies they has. Then it'll recursively install the dependencies.
The--from-paths option indicates we want to install the dependencies for a entire directory of packages, in this case Src. The--IGNORE-SRC option indicates to ROSDEP so it shouldn ' t try to install any ROS packages in the SRC folder from the P Ackage Manager, we don ' t need it to since we is building them ourselves. The--rosdistro option is required because we don has a ROS environment setup yet, so we have to indicate to ROSDEP WHA T version of ROS we is building for. Finally, the-y option indicates to ROSDEP so we don ' t want to being bothered by too many prompts from the package manager.
after a while ROSDEP'll finish installing system dependencies and you can continue.
Note:rosdep PYTHON-ROSDEP, python-catkin-pkg, python-rospkg, and python-rosdistrofailed to install; h Owever, can ignore this error because they has already been installed with PIP.
3.3 Building the Catkin Workspace
Once You has completed downloading the packages and has resolved the dependencies, you is ready to build the Catkin PAC Kages.
Invoke catkin_make_isolated:
$ sudo./src/catkin/bin/catkin_make_isolated--install-dcmake_build_type=release--install-space/opt/ros/indigo
Note:this would install ROS in the equivalent file location to Ubuntu In/opt/ros/indigo However you can modify this as Yo U wish.
For Rviz, you'll also have the this patch with to apply.
Should the compilation fail with a "internal compiler error", it may be because your ' re out of memory. A Quick fix for the-is-to-add swap space to the Pi and recompile.
Raspbian Swap:raspbian uses a script dphys-swapfile to manage Swap. The standard image includes this turned on by default. The configuration files are located at/etc/dphys-swapfile. The only parameter in the file is conf_swapsize=100 which creates a 100MB swapfile in/var/swap. But, putting the Swapfile In/var was not a good idea was that directory was on your SD card. You can change the file location with Conf_swapfile=/your/file/location. My/etc/dphys-swapfile looks like this:
conf_swapsize=1024
Conf_swapfile=/mnt/sda1/swap.file
Here "sda1" are my USB hard drive which is automounted.
It is recommended this reboot your Raspberry Pi to enable the swap.
Now ROS should is installed! Remember to source the new installation. You is recommended to add the ROS environment variables to the ~/.BASHRC file. It is convenient if the ROS environment variables be automatically added to your bash session every time a new shell is L Aunched:
" Source/opt/ros/indigo/setup.bash " >> ~/~/.BASHRC
Note:if you has more than one ROS distribution installed, ~/.BASHRC must only source the Setup.bash for the version of you is currently using.
If you just want to change the environment of your current shell, you can type:
$ source/opt/ros/indigo/setup.bash
If you use zsh instead of bash your need to run the following commands to set up your shell:
$ echo "Source/opt/ros/indigo/setup.zsh" >> ~/.ZSHRC
$ source ~/.ZSHRC
4. Maintaining a Source Checkout
4.1 Updating the Workspace
See the Ubuntu source install instructions for steps on updating the Ros_ws workspace. The same steps should apply to the Raspberry Pi.
4.2 Adding released Packages
You could add additional packages to the installed Ros workspace that has been released into the Ros ecosystem. First, a new Rosinstall file must is created including the new packages (Note, this can also is done at the initial instal L). For example, if we had installed Ros_comm, but want to add Ros_control and joystick_drivers, the command would is:
$ cd ~/--rosdistro Indigo--deps--wet-only--exclude roslisp--tar > Indigo-custom_ros.rosinstall
Keep listing as many ROS packages as you ' d like separated by spaces.
=======================
Note:dynamic_reconfigure
========================
Next, update the workspace with Wstool:
$ wstool merge-t src indigo--t SRC
After updating the workspace, you could want to run ROSDEP to install any new dependencies that is required:
Raspbian Jessie:
$ ROSDEP Install--from-paths src--ignore-src--rosdistro indigo-y-R--os=debian:jessie
Finally, now, the workspace was up to date and dependencies was satisfied, rebuild the workspace:
$ sudo./src/catkin/bin/catkin_make_isolated--install-dcmake_build_type=release--install-space/opt/ros/indigo
Creating Your Own Catkin Workspace
If you haven ' t already do so, create a directory to hold your Catkin workspace. By convention, we'll assume you had created a subdirectory called Catkin_ws in your home directory. Below that directory we create a subdirectory called SRC to hold the package source files. If you ' re starting from scratch, execute the following commands to create a empty Catkin workspace in the directory ~/cat KIN_WS:
$ mkdir-p ~/catkin_ws/~/catkin_ws/src$ catkin_init_workspace
The first command above creates both the top level ~/CATKIN_WS directory and the SRC subdirectory. Note also that we run the catkin_init_workspace command in the SRC directory.
Next, even though the current workspace are empty, we run Catkin_make to create some initial directories and setup files. Catkin_make is always run with the top-level Catkin_ws workspace folder (not in the SRC folder):
$ cd ~/catkin_ws$ catkin_make$ catkin_make Install
After building the new Catkin package, being sure to source the ~/catkin_ws/devel/setup.bash file and rebuild the ROS package Path as follows:
" Source ~/catkin_ws/devel/setup.bash " >> ~/~/.BASHRC
References
[1]http://wiki.ros.org/indigo/installation/source
[2]http://wiki.ros.org/hydro/installation/debian
[3]http://wiki.ros.org/rosberrypi/setting%20up%20hydro%20on%20raspberrypi
[4]http://wiki.ros.org/rosberrypi/installing%20ros%20indigo%20on%20raspberry%20pi
[5]http://www.ros.org/reps/rep-0131.html#id4
[6]https://answers.ros.org/question/230076/ros-on-raspberry-3/
[7]https://answers.ros.org/question/226253/trouble-installing-indigo-on-debian-jessie-collada_parser-build-failure/
[8]https://answers.ros.org/question/266665/ros-indigo-installation-problem-on-raspbian-jessie/
Installing ROS Indigo on the Raspberry Pi