Installing ROSberry Pi on RPi2 (Errors and Solutions)

EDIT: Related to this article or not, before debugging anything with any sort of install of Raspberry Pi, please check if the time and timezone are configured correctly.

To be honest, there’s nothing on this post that isn’t already on the official page at http://wiki.ros.org/ROSberryPi/Installing%20ROS%20Indigo%20on%20Raspberry%20Pi
The reason why I’m writing this is because it took me a whole day to figure out what was wrong and I don’t want anyone else to waste his/her time doing whatever in the world I was doing.

The steps are pretty straightforward, and I’d list them down in order, copy pasting whatever is written on the link mentioned above with few inputs from my side.

First of all, I’d highly recommend a 16GB card on your Pi, as the complete installation itself takes up about 2.5 gigs of space. Considering you have a Pi 2, a fast internet connection and the SD card with Raspbian Wheezy ready, let’s get straight to the stuff.

rosberry
Success!
  1. Open up a terminal and type:
    sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu wheezy main" > /etc/apt/sources.list.d/ros-latest.list'
  2. Then type
    wget https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -O - | sudo apt-key add -
  3. After that, perform an APT repository update and upgrade by typing
    sudo apt-get update && sudo apt-get upgrade
  4. Install some initial bootstrap dependencies by typing down
    sudo apt-get install python-pip python-setuptools python-yaml python-argparse python-distribute python-docutils python-dateutil python-six
  5. Now enter
    sudo pip install rosdep rosinstall_generator wstool rosinstall

    You may need to use sudo -E in case you’re behind a proxy as in my case

  6. Now enter
    sudo rosdep init

    Once again, those behind a http proxy would need to use sudo -E

  7. The next command is
    rosdep update
  8. Now make a new folder, and change directory to the same. Now enter
    rosinstall_generator ros_comm --rosdistro indigo --deps --wet-only --exclude roslisp --tar > indigo-ros_comm-wet.rosinstall
  9. After the long procedure finishes, enter
    wstool init src indigo-ros_comm-wet.rosinstall
  10. Now two dependencies have to be resolved, namely libconsole-bridge-dev and liblz4-dev. Here are the commands in order for the two.
  11. For libconsole:
    cd ~/< name of the folder>/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
  12. For some reason, the process for liblz4 installation didn’t work out in my case. What I did finally was install it manually using deb files. The links are https://packages.debian.org/stretch/armhf/liblz4-1/download and https://packages.debian.org/sid/armhf/liblz4-dev/download (The first one needs to be installed first).
  13. I, for some reason needed to install python-empy (which is not mentioned on the link) . To do that, enter
    sudo pip install empy

    And as usual, the sudo -E for those behind proxy.

  14. Now change directory to the folder you created and enter:
    rosdep install --from-paths src --ignore-src --rosdistro indigo -y -r --os=debian:wheezy

    Ignore any error concerning python-rosdep, python-catkin-pkg, python-rospkg, and python-rosdistro.

  15. Now the step where I was stuck for about 12 hours. Apparently the Pi doesn’t have enough memory to compile roscpp and hence it kept giving errors for the next step. So before that, you need to allocate virtual memory or swap space to Pi so that it can compile it successfully. To do that you have to edit the CONF_SWAPSIZE variable in the dphys-swapfile file, from it’s default value of 100 to 1024. Enter
    sudo nano /etc/dphys-swapfile

    and perform the required changes.

  16. Now for the final installation, enter:
    sudo ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/indigo

    and wait…. took about 45 minutes in my case.

  17. Voila! ROS should be installed. As a last step, edit your bashrc file to add the source command, or simply type into the terminal window,
    echo "source /opt/ros/indigo/setup.bash" >> ~/.bashrc
  18. Try running the roscore command. If it does successfully, don’t forget to recommend this article to a friend.

I’d suggest you to take tips from this post, but if you wish to understand what you’re typing, please visit the page I linked earlier. I hope this helps!

2 thoughts on “Installing ROSberry Pi on RPi2 (Errors and Solutions)

  1. Arey Siddy machaya.. Was googling for soulutions and here you have an organic search engine juice flowing to your site. Aise hi machate raho..

Leave a Reply to Siddharth Jha Cancel reply

Your email address will not be published. Required fields are marked *