Installing ROS2 on a Raspberry Pi 3 B

Keywords: #ros2 #raspberry pi #rolling ridley #quail

Great, yet another “How to install $x$ on $y$” blog post. Exactly what the internet was missing. Just be grateful I’m not serving ads on this website.

I wanted to do my best to ensure this build log was as close to self-contained as reasonable, which means that sometimes we’re going to get low hanging fruit. I found two different sources already covering this, one Youtube Video by Ubuntu-robotics, and a Blog post on Medium. Third place still gets a medal, so I’m going to power on ahead.

Installing the OS:

It’s recommended to use Ubuntu 20.04 LTS for IoT if you’re wanting to use ROS on the pi. You can grab the Pi specific distribution Here. Once you have downloaded it, the page will show links to OS specific tutorials which will take you through flashing the Pi. They will serve you well.

Getting your hands on ROS2-Rolling

I hope you’re seated, because this will knock you off your feet, there are already instructions on the ros website for installing ros2 on ubuntu. Even better? It’s exactly the same for the Pi. Find them Here, specifically, we will be using The debian installation instructions for Rolling Ridley. I installed the ros2-core, as I don’t need any of the GUI at the moment, just follow the instructions there, and return back here once you’re done.

Installing Colcon

Once you have installed the core ros2 packages, you’re going to need to get your hands on the ‘Universal build tool’, Colcon. The usage of colcon is very similar to catkin when dealing with ros1, you can find the installation instructions here: Colcon Readthedocs. In my case, all I needed was:

$ sudo apt update
$ sudo apt install python3-colcon-common-extensions

Then re-source your ~/.bashrc (Or your ros workspace), and you should be good to go.

My development process on the Pi

My editor of choice is Emacs, DOOM Emacs to be specific. It’s not for everyone, but it works well for me. Running things like autocomplete and syntax checking can be a bit slow when running on a pi. My method to help alleviate this is to mount the file system locally on my dekstop, and perform edits through this mounted file system. This process is editor agnostic, so you’re free to use whatever you want to edit the files.

You can install sshfs on the pi with:

$ sudo apt-get install sshfs

From the computer you want to edit from, you can create and mount the file system (In this case, the ros2 workspace) with: (Replace with directories of your choosing!)

$ mkdir ~/ros2_ws_mount
$ sudo sshfs ubuntu@xxx.xxx.xxx.xxx:/ ~/ros2_ws_mount

From there you can navigate to your workspace and get to the fun stuff. Next post, I’ll be introducing you all to the platform that QUAIL will be running on.