Check out my YouTube channel →

Run ROS2 on a Raspberry Pi 5

How to Install ROS2 on a Raspberry Pi 5

As part of my camera operator robot project that I’ve been teasing recently, I needed to start using ROS2 (Robot Operating System 2). I’ve written a million articles about people running ROS and ROS2 on Raspberry Pi SBCs, so I knew that was perfectly doable. And so, without doing any more research, I ordered a Raspberry Pi 5 (4GB) for the job.

If you’re reading this, you probably already know the issue: ROS2 is picky about operating systems and it turns out that it is actually a pain to get it working on a Raspberry Pi 5.

When I was researching this issue, I was amazed that there was so little advice out there. I decided to write this post to explain how I solved the problem, so that others can get ROS2 running on their Raspberry Pi 5 computers. And no, this does not require Docker!

The Issue

The reason that this is even a problem in the first place is that the ROS2 developers take official support very seriously. Each distribution (Humble Hawksbill, Jazzy Jalisco, etc.) is only officially supported on certain specific operating systems.

You can see information about support here on the REP 2000 page.

To simplify a complex topic, there are only installation packages available for certain operating systems. Others require binary releases, still others require compilation from source (a huge pain), and some simply aren’t supported at all.

To further complicate things, the support described in the last paragraph is also dependent on the architecture of the processor. The Raspberry Pi’s ARM processor is less well-supported. That’s especially true for 32-bit installations.

The current version of the Raspberry Pi OS (at the time of writing) is Debian Bookworm. On all three of the current ROS2 distributions (Humble Hawksbill, Iron Irwini, and Jazzy Jalisco), Debian Bookworm only has Tier 3 support and can only be installed by compiling from source. Ew.

All of the advice I could find online suggests installing ROS2 via Docker, as if that is easy to do and doesn’t have any downsides. Personally, I’m not a big fan of Docker and don’t really “get it,” so I wanted a different solution.

The Solution

After trying a whole bunch of different OS distro and ROS2 distro combinations, along with many different solutions I saw suggested online, I finally found one that worked perfectly and that is easy to do.

Humble Hawksbill and Iron Irwini both rely on Ubuntu Jammy (22.04), which is surprisingly hard to install on the Raspberry Pi 5 with a full desktop environment. Fortunately, Jazzy Jalisco is different and supports Ubuntu Noble (24.04).

So that’s how you can make this work: by installing the 64-bit version of Ubuntu Noble [Ubuntu Desktop 24.04.1 LTS (64-bit)] on the Raspberry Pi 5, then installing Jazzy Jalisco on that.

Now that you know the winning combination, everything else should be pretty straightforward.

Use the Raspberry Pi Imager tool to burn the Ubuntu Desktop 24.04.1 LTS (64-bit) image onto your SD card.

I suggest using an SD card with at least 32GB. If the Raspberry Pi Imager asks you, don’t use any OS customization settings.

After writing the image, just pop that SD card in your Raspberry Pi 5 and turn it on. You can then go through the normal Ubuntu installation setup process—create a user, connect to WiFi, choose your keyboard layout, and all of that.

Install Ubuntu 24.04 Noble on a Raspberry Pi 5

Once setup is complete and you’re on the Ubuntu desktop, check for and install any updates.

Then you can follow the normal installation process described here.

Assuming your locale is UTF-8 (it probably is), you only need to run a few commands in your terminal:

  1. Enable repositories
sudo apt install software-properties-common
sudo add-apt-repository universe

2. Add ROS2 GPG key

sudo apt update && sudo apt install curl -y
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg

3. Add repository to sources

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null

4. Install dev tools

sudo apt update && sudo apt install ros-dev-tools

5. Install ROS2 Jazzy Jalisco

Do another update…

sudo apt update

Then another upgrade…

sudo apt upgrade

Then install!

sudo apt install ros-jazzy-desktop

And that’s it, you’ve now got ROS2 (Jazzy Jalisco) installed on your Raspberry Pi 5 and ready to go!

Verify Install

If you want to make sure that everything installed correctly, the easiest way to do so is by running the Turtle Sim.

First, you need to connect the terminal to your ROS2 installation by “sourcing” it. You do that with:

source /opt/ros/jazzy/setup.bash

You need to do that every time you open a new terminal window, but there are instructions in the documentation on how to add that to your bash startup script so it happens automatically.

After you source your ROS2 Jazzy installation, you can install the Turtle Sim with:

https://docs.ros.org/en/jazzy/Tutorials/Beginner-CLI-Tools/Configuring-ROS2-Environment.html

Then, to run it:

ros2 run turtlesim turtlesim_node
ROS2 running on a Raspberry Pi 5

That’s all! Hope this was helpful to you!


Comments

4 responses to “How to Install ROS2 on a Raspberry Pi 5”

  1. Hi, thank you for the guide! It worked like a charm! The only thing I am unable to get to work is the gpio, I tried to even update the rpi5 firmware, install pigpiod, nothing seems to work. Did you get the gpio to work on your installation? Thank you again!

    1. Hi Bill! Sorry, I just saw your comment. I actually didn’t try GPIO (didn’t have a need for it) and no longer have ROS2 installed.

      That’s a strange problem, because it should be unrelated to ROS2. I would suggest asking for assistance on an Ubuntu subreddit or forum.

      Sorry I couldn’t be of more assistance!

  2. Cameron, you are real saviour! I spent 2 days trying to set up ROS2 and if i would not found this page i would probably still trying to install it or would just go with Pi4, big thank you!

    1. I’m glad it was helpful! 🙂

Leave a Reply

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