硬件设备:
RapsBerry 3
操作系统:
Rapsbian OS jessie

  1. Setup ROS Repositories
$ 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 -

2.更新软件源

$ sudo apt-get update
$ sudo apt-get upgrade

3.Install Bootstrap Dependencies

$ 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

4.Initializing rosdep

$ sudo rosdep init
$ rosdep update

Installation

Now, we will download and build ROS Indigo.

Create a catkin Workspace

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

$ mkdir ~/ros_catkin_ws
$ cd ~/ros_catkin_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_catkin_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. 




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.

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_catkin_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_catkin_ws/external_src
$ sudo apt-get build-dep console-bridge
$ apt-get source -b console-bridge
$ sudo dpkg -i libconsole-bridge0.2*.deb libconsole-bridge-dev_*.deb



liblz4-dev:

$ cd ~/ros_catkin_ws/external_src
$ apt-get source -b lz4
$ sudo dpkg -i liblz4-*.deb



Resolving Dependencies with rosdep

The remaining dependencies should be resolved by running rosdep:

Raspbian Wheezy:

$ cd ~/ros_catkin_ws
$ rosdep install –from-paths src –ignore-src –rosdistro indigo -y -r –os=debian:wheezy

Raspbian Jessie:

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

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. If the error persists try building with the -j2 option instead of the default -j4 option:

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

Now ROS should be installed! Remember to source the new installation:

$ source /opt/ros/indigo/setup.bash

Or optionally source the setup.bash in the ~/.bashrc, so that ROS environment variables are automatically added to your bash session every time a new shell is launched:

$ “source /opt/ros/indigo/setup.bash” >> ~/.bashrc

Contents