Installing ROS2 Foxy Fitzroy via Debian Packages on a Raspberry Pi 3 or 4

This page describes installing ROS2 Foxy Fitzroy from binaries on a fresh Ubuntu Server 20.04.2 LTS (RPi 3/4/400) (64-bit) installation running on a Raspberry Pi 4 Model B with 8GB RAM.  The installation was performed in July 2021.

This page is in two sections.  The first section describes an initial failed attempt to install Foxy.  The attempt is based on the instructions from https://docs.ros.org/en/foxy/Installation/Ubuntu-Install-Debians.html

If you just want to see how I made it work, then jump to the second section.

The Failed Attempt

In July 2021 I attempted to install Foxy Fitzroy from binaries on a fresh Ubuntu Server 20.04.2 LTS (RPi 3/4/400) (64-bit) installation running on a Raspberry Pi 4 Model B with 8GB RAM by following the instructions on ROS website: https://docs.ros.org/en/foxy/Installation/Ubuntu-Install-Debians.html

At the time of the installation attempt, ROS2 Galactic (a later version of ROS) was available to install.  Previously I had attempted to install Galactic on a Windows 10 machine but abandoned the attempt as my virus scanner insisted on quarantining some of the files.  I believe the virus scanner was at fault, but it was timelier to install Foxy than get the virus scanner checked out.  Since I had Foxy running on a Windows machine, I opted to run the same version of ROS2 on the Pi.  I figured mixing versions might cause problems elsewhere.

Part of the installation sequence specified on the ROS website is the following command:

sudo apt install ros-foxy-ros-base

This command failed, reporting “install ros-foxy-ros-base failed.  Unable to locate.”

I tried various other similar install commands including ros-foxy-desktop, ros-galactic-ros-base and ros-galactic-desktop.  All reported “Unable to locate.”

Online help for the problem suggests that the hardware isn’t supported; running lscpu reports “aarch64” as the architecture.  ROS2 only supports “amd64” or “arm64”.

The Installation Method that Did Work

I found this video by Sid Faber of Canonical that describes an installation that does work.  The commands that follow have been transcribed from the video.

These commands were performed on a fresh Ubuntu Server 20.04.2 LTS (RPi 3/4/400) (64-bit) installation running on a Raspberry Pi 4 Model B with 8GB RAM in July 2021.  I understand that the commands will also run on a Raspberry Pi 3, although I have not yet tried that. Sid advises to only use the OS version specified for the given ROS install.

The commands follow:

sudo apt-key adv --fetch-keys https://raw.githubusercontent.com/ros/rosdistro/master/ros.key
sudo apt-add-repository http://packages.ros.org/ros2/ubuntu
sudo apt install ros-foxy-ros-base
source /opt/ros/foxy/setup.bash
ros2 –help now yields the ROS help screen.

Sid Faber suggests that getting the help screen shows that ROS is installed.  But I wanted to run the examples from the ROS tutorials.  So, I ran the following command:

sudo apt install ros-foxy-desktop

This adds a lot of files including the tutorial examples.  I think there are probably lighter ways to just install the files I wanted, but the above command does the job.

I can now run the talker, listener and turtle_teleop_key examples from the ROS tutorials on the Pi (with turtlesim_node on the PC, as the Pi is running an OS with no GUI).

%d bloggers like this: