How to Install ROS Kinetic on Raspberry Pi 3 running Raspbian Stretch Lite

I want to install a Raspberry Pi 3 board on an autonomous robot and use it to monitor and control the robot. All communication is via WiFi Internet with ROS Kinetic working on multiple machines.

To use Pi resources more efficiently, I thought I needed an operating system like Raspbian Stretch Lite. The interaction with this system is done through type commands. It doesn’t have GUI and other software included with the Desktop version. In conclusion, it is a perfect operating system if you want to not stress the Pi board with too many tasks that you do not need anyway.

The system will be configured so that Raspberry Pi is the master. The Roscore will run on the robot instead on the remote PC. On the PC I just want to see the message that coming from Pi or send some manual correction back to the robot.

In this tutorial, you will find the steps necessary to install the ROS Kinetic version with no GUI tools (ROS-Commo includes ROS package, build, and communication libraries).

  • Step 1: Download and install Raspbian Stretch Lite
    The installation instructions for Raspberry Lite on Raspberry Pi 3 are described here.

  • Step 2: Connect via SSH to Raspberry Pi to run more easily the ROS Kinetic installation controls.
    sudo sh -c 'echo "deb $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
    wget -O - | sudo apt-key add -
    sudo apt-get update
    sudo apt-get install -y python-rosdep python-rosinstall-generator python-wstool python-rosinstall build-essential cmake
    sudo apt install dirmngr
    sudo rosdep init
    rosdep update
    rosinstall_generator ros_comm --rosdistro kinetic --deps --wet-only --tar > kinetic-ros_comm-wet.rosinstall
    wstool init src kinetic-ros_comm-wet.rosinstall
    rosdep install -y --from-paths src --ignore-src --rosdistro kinetic -r --os=debian:stretch
    sudo ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/kinetic -j2
    source /opt/ros/kinetic/setup.bash
    echo 'source /opt/ros/kinetic/setup.bash' >> ~/.bashrc
    mkdir -p ~/catkin_workspace/src
    cd catkin_workspace/src
    cd ~/catkin_workspace/
    source ~/catkin_workspace/devel/setup.bash
    echo 'source ~/catkin_workspace/devel/setup.bash' >> ~/.bashrc
    export | grep ROS
  • Step 3 (optional): The installation process takes at least two hours. If you have problems and want to reinstall the operating system with ROS Kinetic, the simplest solution is to clone the memory card as soon as you have finished the initial installation. Here are the steps needed to clone the memory card.

Because I’m not an expert on Linux or ROS commands, I’ve found valuable information here and here.

4 comments » Write a comment

  1. I am getting my Raspberry Pi freezed when I used this command:
    sudo ./src/catkin/bin/catkin_make_isolated –install -DCMAKE_BUILD_TYPE=Release –install-space /opt/ros/kinetic -j2
    Specifically it freezes while installing the “roscpp” package.

    • Hi! Maybe you could try to remove the “-j2” at the end of the command. It is written to run the order in two threads, what is faster, but sometimes the raspberrys have problems executing commands in multiple threads.

      • On mine, if you don’t explicitly set to single core it uses 4 cores. So use “-j1” instead of “-j2” at the end of the command.

        I’ve also read that you can deal with this by upping the swap space to 2GB. I did both, but the swap space was not needed. With 2 cores, the memory usage went up to 100%. I’ve read that’s because of deadlocks waiting for memory.

  2. So I’ve spent the past few weeks trying to research how to get ROS Melodic on a Raspberry Pi 3 B+ with Raspbian Lite (Stretch). It seems following your instructions and replacing `kinetic` with `melodic` actually did the trick!

Leave a Reply

Required fields are marked *.