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 be 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 is 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:

$ sudo sh -c '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 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 will download and build ROS Indigo.
3.1 Create a catkin Workspace

In order to build the core packages, you will need a catkin workspace. Create one now:

$ mkdir ~/ros_ws
$ cd ~/ros_ws

Next we will want to fetch the core packages so we can build them. We will use wstool for this. Select the wstool command for the particular variant you 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 indigo-ros_comm-wet.rosinstall

This will add all of the catkin or wet packages in the given variant and then fetch the sources into the~/ros_ws/src directory. The command will 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 is excluded in these generators because the dependency sbcl is not available in the Raspbian repositories. Building sbcl from source may be possible but is not tested. So far, only these two variants have been tested on the Raspberry Pi in Indigo; however, more are defined in REP 131such as robot, perception, etc. Just change the package path to the one you 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 you 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, you need to make sure that you have all the required dependencies. We use the rosdep tool for this, however, a couple of dependencies are not available in the repositories. They must be manually built first.
3.2.1 Unavailable Dependencies

Following packages are 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 are 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 be built from source in a new directory:

$ mkdir ~/ros_ws/external_src
$ sudo apt-get install checkinstall cmake
$ sudo sh -c '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-bridge
$ sudo dpkg -i libconsole-bridge0.*.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 -b lz4
$ sudo dpkg -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 checkinstall make install

When check-install asks for any changes, the name (2) needs to change from "urdfdom-headers" to "liburdfdom-headers-dev" otherwise 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 for any changes, the name (2) needs to change from "urdfdom" to "liburdfdom-dev" otherwise the rosdep install wont find it.

collada-dom-dev: (Note: You will 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 for any changes, the name (2) needs to change from "collada-dom" to "collada-dom-dev" otherwise the rosdep install wont find it.

Note: If you don't want to compile Collada but 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 > indigo-desktop-wet.rosinstall

3.2.2 Resolving Dependencies with rosdep

The remaining dependencies should be resolved by running rosdep:
Raspbian Jessie:

$ cd ~/ros_ws
$ rosdep install --from-paths src --ignore-src --rosdistro indigo -y -r --os=debian:jessie

This will look at all of the packages in the src directory and find all of the dependencies they have. Then it will recursively install the dependencies.

The --from-paths option indicates we want to install the dependencies for an entire directory of packages, in this case src. The --ignore-src option indicates to rosdep that it shouldn't try to install any ROS packages in the src folder from the package manager, we don't need it to since we are building them ourselves. The --rosdistro option is required because we don't have a ROS environment setup yet, so we have to indicate to rosdep what version of ROS we are building for. Finally, the -y option indicates to rosdep that we don't want to be bothered by too many prompts from the package manager.
After a while rosdep will finish installing system dependencies and you can continue.
Note: Rosdep may report that python-rosdep, python-catkin-pkg, python-rospkg, and python-rosdistrofailed to install; however, you can ignore this error because they have already been installed with pip.
3.3 Building the catkin Workspace

Once you have completed downloading the packages and have resolved the dependencies, you are ready to build the catkin packages.
Invoke catkin_make_isolated:

$ sudo ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/indigo

Note: This will install ROS in the equivalent file location to Ubuntu in /opt/ros/indigo however you can modify this as you wish.

For rviz, you will also have to apply this patch.
Should the compilation fail with an "internal compiler error", it may be because you're out of memory. A quick fix for this 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 is 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 is not a good idea is that directory is 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" is my usb hard drive which is automounted.
It is recommended that you reboot your Raspberry Pi to enable the swap change.
Now ROS should be installed! Remember to source the new installation. You are recommended to add the ROS environment variables to the ~/.bashrc file. It is convenient if the ROS environment variables are automatically added to your bash session every time a new shell is launched:

$ echo "source /opt/ros/indigo/setup.bash" >> ~/.bashrc
$ source ~/.bashrc

Note: If you have more than one ROS distribution installed, ~/.bashrc must only source the setup.bash for the version you are 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 you 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 may add additional packages to the installed ros workspace that have been released into the ros ecosystem. First, a new rosinstall file must be created including the new packages (Note, this can also be done at the initial install). For example, if we have installed ros_comm, but want to add ros_control and joystick_drivers, the command would be:

$ cd ~/ros_ws
$ rosinstall_generator ros_comm ros_control joystick_drivers --rosdistro indigo --deps --wet-only --exclude roslisp --tar > indigo-custom_ros.rosinstall

You may 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-custom_ros.rosinstall
$ wstool update -t src

After updating the workspace, you may want to run rosdep to install any new dependencies that are required:

Raspbian Jessie:

$ rosdep install --from-paths src --ignore-src --rosdistro indigo -y -r --os=debian:jessie

Finally, now that the workspace is up to date and dependencies are 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 done so, create a directory to hold your catkin workspace. By convention, we will assume you have 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 an empty catkin workspace in the directory ~/catkin_ws:

$ mkdir -p ~/catkin_ws/src
$ cd ~/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 is empty, we run catkin_make to create some initial directories and setup files. catkin_make is always run in 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, be sure to source the ~/catkin_ws/devel/setup.bash file and rebuild the ROS package path as follows:

$ echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
$ source ~/.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的更多相关文章

  1. Roomblock: a Platform for Learning ROS Navigation With Roomba, Raspberry Pi and RPLIDAR(转)

      What is this? "Roomblock" is a robot platform consists of a Roomba, a Raspberry Pi 2, a ...

  2. 在树莓派2代B型/3代 上安装Fedora23 - Installing Fedora 23 on Raspberry Pi 2 model B or Raspberry Pi 3

    本文主要用于记录安装过程,以便日后查阅回顾. 之前在自己的树莓派上运行的一直是通过NOOB安装的Raspbian,但是本人平时更喜欢用Fedora作为开发和使用环境,而且Raspbian上的软件包通常 ...

  3. RASPBERRY PI 外设学习资源

    参考: http://www.siongboon.com/projects/2013-07-08_raspberry_pi/index.html Raspberry Pi         Get st ...

  4. Raspberry Pi I2C驱动 (Python)

    本文参考 http://www.instructables.com/id/Raspberry-Pi-I2C-Python/all/?lang=zh 作者 AntMan232 In this instr ...

  5. ubuntu14.04 and ros indigo install kinect driver--16

    摘要: 原创博客:转载请表明出处:http://www.cnblogs.com/zxouxuewei/ 今日多次测设ros indigo install kinect driver ,提示各种失败,然 ...

  6. Raspberry Pi B+ 定时向物联网yeelink上传CPU GPU温度

     Raspberry Pi B+ 定时向物联网yeelink上传CPU GPU温度 硬件平台: Raspberry Pi B+ 软件平台: Raspberry 系统与前期安装请参见:树莓派(Ros ...

  7. Turn Your Raspberry Pi Into a WiFi Hotspot with Edimax Nano USB EW-7811Un (RTL8188CUS chipset)

    http://www.daveconroy.com/turn-your-raspberry-pi-into-a-wifi-hotspot-with-edimax-nano-usb-ew-7811un- ...

  8. [树莓派(raspberry pi)] 01、在linux环境下给树莓派安装系统及入门各种资料

    1.预准备 进入帮助页面https://www.raspberrypi.org/help/,可以直接看到GET START WITH PASPBERRY PI,点击进入: 接下来会引导你检查配件是否齐 ...

  9. ROS连接ABB机械臂调试详细教程-ROS(indigo)和ABB RobotStudio 6.03.02-

    在ROS industrial介绍中,给出了ROS和常用机械臂的连接方式.具体信息可以参考:http://wiki.ros.org/Industrial ROS连接ABB机械臂调试详细教程-ROS(i ...

随机推荐

  1. YII2 console中引用其他模块(子项目)的model时出现model找不到命名空间的问题解决

    YII2 console中写定时任务, 想使用其他模块的model, 在 console的yii.php 入口文件中引入其他模块的配置文件, 否者会出现model等命名空间找不到的问题. 还有, 命名 ...

  2. Python科学计算PDF

    Python科学计算(高清版)PDF 百度网盘 链接:https://pan.baidu.com/s/1VYs9BamMhCnu4rfN6TG5bg 提取码:2zzk 复制这段内容后打开百度网盘手机A ...

  3. Windows下利用MKL加速caffe,与openblas比较

    一.介绍:先简单Mark一下网上的介绍资料,弄清楚MKL是个啥,已经与openblas等的关系. 矩阵运算库blas, cblas, openblas, atlas, lapack, mkl之间有什么 ...

  4. git HEAD detached from origin 问题的解决

    这个问题是因为分支选错了,所以说后续的提交都提交到了一个匿名分支之上,整个状态是游离了的 下面说一下我解决问题的步骤 1.查看在游离状态下提交的最新commit号 git branch -v 2.创建 ...

  5. Mac下GTest的基本使用

    Mac下GTest的基本使用 gtest全称Google C++ Testing Framework,它是从谷歌内部诞生并受到业界追捧的一个非常优秀的测试框架,支持如自动发现测试.自定义断言.死亡测试 ...

  6. node.js官方文档解析 01—assert 断言

    assert-------断言 new assert.AssertionError(options) Error 的一个子类,表明断言的失败. options(选项)有下列对象 message < ...

  7. 201771010126 王燕《面向对象程序设计(java)》第八周学习总结

    实验六 接口的定义与使用 实验时间 2018-10-18 1.实验目的与要求 (1) 掌握接口定义方法 JAVA中通过interface关键字定义接口: 接口中只能定义public static fi ...

  8. ant design select placeholder不生效原因

    当select的value绑定一个state默认值时,如果默认值是''或null时,placeholder不生效 解决方案:默认值设为undefined

  9. Java课程2019年3月开学测试

    一.登录界面 模板的验证方式已经写在了function里面,我们只需要在提交的过程中进行验证. 我们这里需要注意到的是在login文件夹中,有一个randcode的验证码生成文件,打开代码我们可以看到 ...

  10. Servlet.service() for servlet [jsp] in context with path [/Healthy_manager] threw exception [Unable to compile class for JSP] with root cause java.lang.IllegalArgumentException: Page directive: inval

    严重: Servlet.service() for servlet [jsp] in context with path [/Healthy_manager] threw exception [Una ...