Robot Operating System on a Raspberry Pi

Download and install ROS Indigo from scratch

Setup Rasbian OS

Install ROS from source

Setup dependencies:

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu wheezy main" > /etc/apt/sources.list.d/ros-latest.list'
wget https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -O - | sudo apt-key add -
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install python-setuptools python-pip python-yaml python-argparse python-distribute python-docutils python-dateutil python-setuptools python-six
sudo pip install rosdep rosinstall_generator wstool rosinstall

Setup ROS:

sudo rosdep init
rosdep update
mkdir ~/ros_catkin_ws
cd ~/ros_catkin_ws
rosinstall_generator desktop --rosdistro indigo --deps --wet-only --exclude roslisp --tar > indigo-desktop-wet.rosinstall
wstool init src indigo-desktop-wet.rosinstall

Things which don't work out of the box

Fixing the broken packages:

mkdir ~/ros_catkin_ws/broken_packages
cd ~/ros_catkin_ws/broken_packages

Download:

apt-get install -y lsb-release
apt-get download -y python-rosdistro python-rospkg python-catkin-pkg python-rosdep

Extract:

dpkg-deb -x python-rosdistro_0.4.1-1_all.deb python-rosdistro
dpkg-deb -e python-rosdistro_0.4.1-1_all.deb python-rosdistro/DEBIAN
dpkg-deb -x python-rospkg_1.0.35-1_all.deb python-rospkg
dpkg-deb -e python-rospkg_1.0.35-1_all.deb python-rospkg/DEBIAN
dpkg-deb -x python-catkin-pkg_0.2.7-1_all.deb python-catkin-pkg
dpkg-deb -e python-catkin-pkg_0.2.7-1_all.deb python-catkin-pkg/DEBIAN
dpkg-deb -x python-rosdep_0.11.2-1_all.deb python-rosdeb
dpkg-deb -e python-rosdep_0.11.2-1_all.deb python-rosdeb/DEBIAN

Remove the python:any (>= 2.7.1-0ubuntu2) from */DEBIAN/control

vi */DEBIAN/control

Repackage:

mkdir ~/ros_catkin_ws/broken_packages/new
dpkg -b python-rosdistro new/python-rosdistro_0.4.1-1_all.deb
dpkg -b python-rospkg new/python-rospkg_1.0.35-1_all.deb
dpkg -b python-catkin-pkg new/python-catkin-pkg_0.2.7-1_all.deb
dpkg -b python-rosdeb new/python-rosdep_0.11.2-1_all.deb

Install:

sudo dpkg -i new/*.deb

Fix collada_urdf:

cd ~/ros_catkin_ws/src/robot_model/collada_urdf/src
vi fix.patch
diff --git a/src/collada_urdf.cpp b/src/collada_urdf.cpp
index acebfb2..1d4beb6 100644
--- a/src/collada_urdf.cpp
+++ b/src/collada_urdf.cpp
@@ -68,6 +68,13 @@
 #include <assimp/IOSystem.hpp>
 #include <assimp/Importer.hpp>
 #include <assimp/postprocess.h>
+#  ifdef __arm__                 // fix for ARM build
+#include <strings.h>
+bool Assimp::IOSystem::ComparePaths(const char *p1, const char *p2) const
+{
+    return !::strcasecmp(p1, p2);
+}
+#  endif
 #else
 #include <assimp.hpp>
 #include <aiScene.h>


patch < fix.patch

Fix rviz:

vi ~/ros_catkin_ws/src/rviz/src/rviz/mesh_loader.cpp

 #include <assimp/aiPostProcess.h>
 #include <assimp/IOStream.h>
 #include <assimp/IOSystem.h>
 #endif
+#  ifdef __arm__                 // fix for ARM build
+#include <strings.h>
+bool Assimp::IOSystem::ComparePaths(const char *p1, const char *p2) const
+{
+    return !::strcasecmp(p1, p2);
+}
+#  endif

Compile some additional packages from source

mkdir ~/ros_catkin_ws/external_src
sudo apt-get -y 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: Install with the following:

cd ~/ros_catkin_ws/external_src
sudo apt-get -y build-dep console-bridge
apt-get -y source -b console-bridge
sudo dpkg -i libconsole-bridge0.2_*.deb libconsole-bridge-dev_*.deb

liblz4-dev: Install with the following:

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

liburdfdom-headers-dev: Install with the following:

cd ~/ros_catkin_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: Install with the following:

cd ~/ros_catkin_ws/external_src
sudo apt-get -y 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: Install with the following:

cd ~/ros_catkin_ws/external_src
sudo apt-get -y 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.

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

Building the workspace

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

Fix rviz

rviz will fail with the following error:

Makefile:123: recipe for target 'all' failed
make: *** [all] Error 2
<== Failed to process package 'rviz': 
  Command '['/opt/ros/indigo/env.sh', 'make', '-j4', '-l4']' returned non-zero exit status 2

Reproduce this error by running:
==> cd /home/jorg/ros_catkin_ws/build_isolated/rviz && /opt/ros/indigo/env.sh make -j4 -l4

Command failed, exiting.

Compile with just 2 cores instead:

cd ~/ros_catkin_ws/build_isolated/rviz
sudo make -j2

Now try building the workspace again, to get the remaining packages compiled.

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