Installing ROS Hydro on the Raspberry Pi

April 27th, 2014 by .

These are the steps that I used to install ROS Hydro on the Raspberry Pi. Hydro was used because having both wet and dry packages in Groovy was causing issues. Therefore, either going to a complete rosbuild (Fuerte) or complete catkin (Hydro) is preferred. There will be as much rationale given for each step as possible along the way so that the beginning can understand what is happening. Warning. The Husky ROS drivers don’t seem to be communicating properly with the Husky, although everything else works fine. We will have to report back on that later.

  1. Setup the Raspberry Pi with Raspbian
  2. Start with NOOBS and install Raspbian. I used an 8GB SD card but a 16GB is preferred.

  3. Install repositories:
  4. $ sudo su
    $ sh -c ‘echo “deb raring main” > /etc/apt/sources.list.d/ros-latest.list’
    $ sh -c ‘echo “deb wheezy main” > /etc/apt/sources.list.d/rospbian.list’
    $ exit
    $ wget -O – | sudo apt-key add –
    $ wget -O – | sudo apt-key add –
    $ sudo apt-get update
    $ sudo apt-get upgrade

  5. Install dependencies (30 – 45 mins):
  6. $ sudo apt-get install build-essential python-yaml cmake subversion wget python-setuptools mercurial git-core libapr1-dev libaprutil1-dev libbz2-dev python-dev libgtest-dev python-paramiko libboost-all-dev liblog4cxx10-dev pkg-config python-empy swig python-nose lsb-release python-pip python-gtk2 python-stdeb

    Sometimes, setuptools will not build correctly from packages. Below is the method to building from source:
    $ cd ~/Downloads
    $ wget
    $ tar xvf setuptools-1.1.6.tar.gz
    $ cd setuptools-1.1.6
    $ sudo python install

    $ sudo pip install rosdistro
    $ sudo pip install rosdep
    $ sudo pip install rosinstall-generator
    $ sudo pip install wstool

    $ pip install -U rospkg
    $ sudo apt-get install python-rosdep python-rosinstall-generator build-essential

  7. Create build directory:
  8. $ mkdir ~/ros_catkin_ws
    $ cd ~/ros_catkin_ws

  9. Build ROS Hydro:
  10. First you must select which version of ROS Hydro you wish to build. For the different variants of ROS see here. For this guide, I will build the robot variant, as I wish for the Raspberry Pi to sit on and control the Husky robot. You can substitute the name of the variant in the following lines of code.

    $ rosinstall_generator robot –rosdistro hydro –deps –wet-only > hydro-robot.rosinstall

    We will use –j1 and build the packages one at a time because the processing capabilities of the Pi are smaller than that of a normal computer.

    $ GIT_SSL_NO_VERIFY=true wstool init –j1 src hydro-robot.rosinstall
    $ sudo rosdep init
    $ rosdep update

    We must check on the dependicies of the ROS packages we are going to install.

    $ rosdep check –from-paths src –ignore-src –rosdistro hydro –os=debian:wheezy

    The output is a list of unmet dependencies. We will deal with these in a second. After the list of unmet dependencies is a list of packages with reference errors. Sometimes, we have built dependencies from packages outside of our ros workspace, but rosdep is expecting them there. Make sure the dependency is installed (using apt-get or another method) and then delete reference to the package from the package.xml file for the dependent packages. Run the above command again, and the only items listed should be the unsatisfied dependencies. Once this is the case, move on to the next step.

    These are the packages that rosdep will install for us so that we can successfully build Hydro. In some cases, there will not be packages available for building the dependencies which will cause rosdep to fail. In this case, the dependency must be built from source, or the packages that are the dependents must be removed. In the case of building the robot variant, two packages which cannot be install from packages by rosdep are ‘sbcl’ and ‘collada dom.’

    The dependent for ‘sbcl’ is roslisp which we will not be needing enough to warrant building from source, although the option is available (not included in this guide). The dependents for ‘collada dom’ are from the robot_model stack: collada_parser and collada_urdf. Collada dom is a very large package which is used by Gazebo to generate nice 3D graphics. Since we won’t need this on our robot, and the raspberry pi has very limited space we will not install this either. (Note: The author did try to build collada dom from source and ran out of storage on the SD Card. If you plan to install collada dom, make sure you have a 16GB card or higher).

    To remove the unwanted dependents do the following: navigate to the workspace directory, use the wstool to remove reference to the dependent, navigate to the dependent package source, delete the package directory. The example is given for the collada_parser package.

    $ cd ~/ros_catkin_ws/src/robot_model
    $ wstool rm collada_parser
    $ rm -rf collada_parser

    Once all dependents are removed. Use rosdep to attempt to install all needed dependencies. If there is an error, you may need to build the dependency from scratch or you may need to remove the dependents.

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

    Once you have successfully built all the dependencies, you are ready to build the workspace. Navigate to the workspace directory and make using catkin. Note, that since catkin is not installed yet, you will have to link directory to the executable.

    $ cd ~/ros_catkin_ws
    $ ./src/catkin/bin/catkin_make_isolated –install

    Sometimes, you will not be able to find the catkin_make_isolated command in the catkin/bin folder. If that is the case, then re-import the catkin package using rosinstall_generator. The executable should import on the second try If it didn’t on the first.

    $ cd ~/ros_catkin_ws
    $ rosinstall_generator catkin –rosdistro hydro –deps | wstool merge -t src –
    $ wstool update -t src –j1

  11. Testing:
  12. Source the setup.bash file and test to ensure you can run roscore.

    $ source ~/ros_catkin_ws/install_isolated/setup.bash
    $ roscore

  13. Building additional packages:
  14. Additional packages can be built from source by adding them to the workspace, checking for any new dependencies, and then building using catkin. We wish to add the packages for the Husky robot and the robot_upstart package which it is dependent on.

    $ cd ~/ros_catkin_ws
    $ rosinstall_generator robot_upstart –rosdistro hydro –deps | wstool merge -t src –
    $ rosinstall_generator husky_robot –rosdistro hydro –deps | wstool merge -t src –
    $ wstool update -t src –j1
    $ rosdep check –from-paths src –ignore-src –rosdistro hydro –os=debian:wheezy

    I had to deal with a couple of dependencies, and needed to install libpcl1-dev

    $ rosdep install –from-paths src –ignore-src –rosdistro hydro -y –os=debian:wheezy
    $ cd ~/ros_catkin_ws
    $ ./src/catkin/bin/catkin_make_isolated -–install

    A couple of packages would not build with the libpcl1-dev package, they were looking for the libpcl-all-dev. As such I had to skip the installation of some packages (pcl_ros perception_pcl) and build some by hand. To decide which packages were built and installed use

    $ ./src/catkin/bin/catkin_make_isolated -–install –-pkg [list packages with spaces and no brackets]