Installing ROS 2 on Raspberry Pi: A Comprehensive Guide

Introduction

Little Fish Says:

Installing ROS 2 on Raspberry Pi can be understood in two ways, which many beginners often confuse. The first is to install ROS 2 on Raspberry Pi hardware, and the second is to install ROS 2 on the native Raspberry Pi operating system. For the first option, you can install an Ubuntu system that supports Raspberry Pi and then directly use the one-click installation for ROS 2. For the second option, it is a bit more complicated, and it is best to use a Docker image directly.

ROS 2 on Raspberry Pi

ROS 2 supports 32-bit (arm32) and 64-bit (arm64) ARM processors. However, you can see here: https://www.ros.org/reps/rep-2000.html that arm64 is first-class support while arm32 is third-class support. First-class support means there are specific distribution packages and binary archives available, while third-class support requires users to compile ROS 2 from source code.

Using a first-class supported configuration is the fastest and easiest way to use ROS 2.

This means you need to install 64-bit Ubuntu on the Raspberry Pi, or use the 64-bit version of the Raspberry Pi operating system and run ROS 2 in Docker.

Using Ubuntu Linux with Binary Installation of ROS 2 on Raspberry Pi

Ubuntu for Raspberry Pi is available at https://ubuntu.com/download/raspberry-pi.

Please ensure you have selected the correct version as described in REP-2000.

You can now follow the regular binary installation instructions for ROS 2 on Ubuntu Linux.

Using ROS 2 on Raspberry Pi OS in Docker

The 64-bit version of Raspberry Pi OS can be obtained here: https://www.raspberrypi.com/software/operating-systems/.

Raspberry Pi OS is based on Debian, which has third-class support, but can run Ubuntu Docker containers for first-class support.

After flashing the operating system, please use this link https://docs.docker.com/engine/install/debian/#install-using-the-convenience-script to install Docker.

The official OSRF ROS 2 Docker container definitions can be found here: https://github.com/osrf/docker_images/.

You can choose to use ros-core, ros-base, or ros-desktop. For more information on these variants, refer to https://github.com/osrf/docker_images/.

Clone the docker_images git repository to Raspberry Pi, switch to the directory from the above link, and then enter the directory of your preferred variant.

In that directory, use the following command to build the container:

docker build -t ros_docker .

On supported systems, building the docker container only takes a minute or two, as the source code has already been built into binaries.

Pre-built Docker Containers

Pre-built desktop variant containers are also available, and you can simply execute the docker pull command.

For more information, please refer to this page https://github.com/osrf/docker_images/.

Leave a Comment

×