Installing ROS on Raspberry Pi

1. Installation Environment

Raspberry Pi B+, ROS Indigo, 16G TF card, Raspbian OS

2. Installation Equipment

2.1 Prepare the ROS Code Repository

[html] view plain copy

  1. sudo sh -c ‘echo “deb http://packages.ros.org/ros/ubuntu wheezy main” > /etc/apt/sources.list.d/ros-latest.list’

  2. wget https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -O – | sudo apt-key add –

Ensure Raspbian OS is updated

[html] view plain copy

  1. sudo apt-get update

  2. sudo apt-get upgrade

2.2 Install Bootstrap Dependencies

[html] view plain copy

  1. sudo apt-get install python-setuptools

  2. sudo easy_install pip

  3. sudo pip install -U rosdep rosinstall_generator wstool rosinstall

2.3 Initialize rosdep

[html] view plain copy

  1. sudo rosdep init

  2. rosdep update

3. Compile ROS

3.1 Create a workspace to compile ROS

[html] view plain copy

  1. mkdir ~/ros_catkin_ws

  2. cd ~/ros_catkin_ws

Next, download the ROS code. ROS provides two code packages.

1) ROS-Comm: This is the officially recommended version, but it only contains basic ROS communication functions without navigation, TF, action, RViz, and other GUI tools.

2) Desktop: The complete ROS functionality suitable for all robotic applications. We choose to install this.

The following command downloads and generates the compilation package list, which may take a long time.

[html] view plain copy

  1. rosinstall_generator desktop –rosdistro indigo –deps –wet-only –exclude roslisp –tar > indigo-desktop-wet.rosinstall

  2. wstool init -j8 src indigo-desktop-wet.rosinstall

If the download is interrupted, the following command will continue the download:

[html] view plain copy

  1. wstool update -j 4 -t src

3.2 Resolve Dependencies

libconsole-bridge-dev, liburdfdom-headers-dev, liburdfdom-dev, liblz4-dev, and collada-dom-dev are not included in Raspbian and need to be manually compiled and downloaded.

Create a new directory to download these five packages.

[html] view plain copy

  1. <span style=“font-size:18px;”>mkdir ~/ros_catkin_ws/external_src

  2. sudo apt-get install checkinstall cmake</span>

Install libconsole-bridge-dev:

[html] view plain copy

  1. <span style=“font-size:18px;”>cd ~/ros_catkin_ws/external_src

  2. sudo apt-get install libboost-system-dev libboost-thread-dev

  3. git clone https://github.com/ros/console_bridge.git

  4. cd console_bridge

  5. cmake .

  6. sudo checkinstall make install</span>

When checkinstall asks if you want to change installation options, select [2] to change the name from “console-bridge” to “libconsole-bridge-dev”

For the next two questions, select ‘n’ continuously, otherwise it will compile incorrectly.

Installliblz4-dev

[html] view plain copy

  1. <span style=“font-size:18px;”>$ cd ~/ros_catkin_ws/external_src

  2. $ wget http://archive.raspbian.org/raspbian/pool/main/l/lz4/liblz4-1_0.0~r122-2_armhf.deb

  3. $ wget http://archive.raspbian.org/raspbian/pool/main/l/lz4/liblz4-dev_0.0~r122-2_armhf.deb

  4. $ sudo dpkg -i liblz4-1_0.0~r122-2_armhf.deb liblz4-dev_0.0~r122-2_armhf.deb</span>

Installliburdfdom-headers-dev

[html] view plain copy

  1. <span style=“font-size:18px;”>$ cd ~/ros_catkin_ws/external_src

  2. $ git clone https://github.com/ros/urdfdom_headers.git

  3. $ cd urdfdom_headers

  4. $ cmake .

  5. $ sudo checkinstall make install</span>

When checkinstall asks if you want to change installation options, select [2] to change the name from “urdfdom-headers” to “liburdfdom-headers-dev”

For the next two questions, select ‘n’ continuously, otherwise it will compile incorrectly.

Installliburdfdom-dev

[html] view plain copy

  1. <span style=“font-size:18px;”>$ cd ~/ros_catkin_ws/external_src

  2. $ sudo apt-get install libboost-test-dev libtinyxml-dev

  3. $ git clone https://github.com/ros/urdfdom.git

  4. $ cd urdfdom

  5. $ cmake .

  6. $ sudo checkinstall make install</span>

When checkinstall asks if you want to change installation options, select [2] to change the name from “urdfdom” to “liburdfdom-dev”

For the next two questions, select ‘n’ continuously, otherwise it will compile incorrectly.

Install collada-dom-dev

[html] view plain copy

  1. <span style=“font-size:18px;”>$ cd ~/ros_catkin_ws/external_src

  2. $ sudo apt-get install libboost-filesystem-dev libxml2-dev

  3. $ wget http://downloads.sourceforge.net/project/collada-dom/Collada%20DOM/Collada%20DOM%202.4/collada-dom-2.4.0.tgz

  4. $ tar -xzf collada-dom-2.4.0.tgz

  5. $ cd collada-dom-2.4.0

  6. $ cmake .

  7. $ sudo checkinstall make install</span>

When checkinstall asks if you want to change installation options, select [2] to change the name from “collada-dom” to “collada-dom-dev”

For the next two questions, select ‘n’ continuously, otherwise it will compile incorrectly.

3.3 Resolve Dependencies with rosdep

[html] view plain copy

  1. <span style=“font-size:18px;”>$ cd ~/ros_catkin_ws

  2. $ rosdep install –from-paths src –ignore-src –rosdistro indigo -y -r –os=debian:wheezy</span>

The above command will traverse all packages and recursively install dependencies.

3.4 Start Compiling ROS

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

Common Errors:

During compilation, more than 180 packages will be compiled and installed in the /opt/ros/indigo directory. It often reports errors for the packages ‘urdf’, ‘collada_parser’, and ‘collada_urdf’, causing the installation to be interrupted. The solution is to move these three packages out of the ~/ros_catkin_ws/src/robot_model directory and recompile the entire ROS. Finally, create a separate workspace and place the three packages in the src/robot_model directory. Then execute the following command:

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

If errors persist, you need to reinstall the packages liburdfdom-dev, liblz4-dev, and collada-dom-dev one by one as described in step 3.2. After installing each one, recompile, and successfully compiled packages can be deleted until all compile successfully.

Leave a Comment

×