ROS Noetic installation on Raspberry Pi 4 with Ubuntu Mate 20.04 - brennanyama/RobotOperatingSystem GitHub Wiki

ROS Noetic installation on Raspberry Pi 4 with Ubuntu Mate 20.04

1. Hardware Setup

  • Raspberry Pi 4 Model B 8GB (4GB or 8GB version preferred)
  • A microSD card. Generally any model will do, preferably 128GB or greater and Class 10 or above.
  • Raspberry Pi CPU cooler
    • A cooler is required to get the full performance out of the Pi. Coolers integrated with cases for the Raspberry Pi are common, but for embedded applications, a case is not strictly necessary and limits cooling potential. Make sure you're checking that the cooler is compatible with anything you want to attach to the Raspberry Pi, particularly with the GPIO pin headers.
  • Voltage regulator to 5V. This is usually in the form of a buck (step down) regulator from a higher voltage source.
    • Note: you could use the USB-C port to provide power to the Raspberry Pi 4 in a pinch; however, the Raspberry Pi 4 requires much more power than previous models, and we found that most USB-C chargers (even fast charge models capable of 3A down the 5V line) result in under-voltage warnings, even before overclocking. The best method of ensuring consistent power under load is an external 5V regulator directly to the 5V line of the Raspberry Pi; ensure the regulator outputs a clean signal and is capable of at least 5A.
  • A monitor (preferably a portable one for field work) with the appropriate display adapters and cables.
    • Note: the Raspberry Pi 4 uses a microHDMI (unlike older models which use the standard HDMI connector)
    • Note: if you do purchase a portable monitor, make sure that you pick one that supports display over HDMI or DisplayPort (the two modern display standards). Do not pick a monitor that uses “DisplayLink” (requires a Windows-only software driver that sends display over USB 3.0), and do not pick a monitor that only supports display over USB-C (the Raspberry Pi 4 has a USB-C port, but it is for charging only and does not support display output). Ideally this monitor should support display over HDMI and power via USB or some type of direct power input jack (like a barrel connector).
  • A keyboard and mouse.
Here is an image of an example hardware setup.

2. Ubuntu Mate 20.04 (Focal) installation

2.1. What is Ubuntu Mate? Why use Ubuntu mate over "vanilla" Ubuntu?

Ubuntu Mate can be called a "fork" of the "vanilla" Ubuntu operating system maintained by Canonical Ltd. Ubuntu is an open source project, which means that its source code is freely available to distribute and reproduce. As a result there are many alternative distributions of Ubuntu (Ubuntu Mate is one of many).

So why use Ubuntu Mate? Theoretically there is no compelling reason to use any particular Ubuntu distribution over another (in this case Ubuntu Mate over Ubuntu). That said, the Raspberry Pi (a single board computer based on the ARM instruction set) generally receives support later than x86/AMD64 systems for each Ubuntu distribution. Historically Ubuntu Mate has been quicker to release a working port of Ubuntu with desktop environment on the Raspberry Pi and generally tends to have better support overall than the vanilla distribution of Ubuntu.

At the time of writing, vanilla Ubuntu includes a LTS distribution of Server (no desktop environment) Ubuntu 20.04.1 for 32-bit (ARM32) and 64-bit (ARM64) Raspberry Pis; however, the Desktop version of vanilla Ubuntu 20.xx only has a short-term support release ARM32 and ARM64 (link here). Conversely, Ubuntu Mate includes Ubuntu 20.04.1 LTS for both ARM32 and ARM64. So if you desire a using a Raspberry Pi (or ARM-based single board computer), Ubuntu Mate currently offers a LTS distribution whereas vanilla Ubuntu does not.

2.2. Ubuntu Mate 20.04.1 installation

We will be installing ROS on top of Ubuntu Mate 20.04 (Focal).

First, download the Ubuntu Mate 20.04 for ARM64 from this link. You will also need a software for flashing the OS to the microSD card; we use the balenaEtcher software from this link. Flash the downloaded Ubuntu 20.04 .iso file to the microSD card. Insert the microSD card into the Raspberry Pi and power it on by supplying power into the voltage regulator.

Run all initial setups of the OS, including setting timezone, password, wi-fi, display settings, and initial software updates (apt-get update, apt-get upgrade, apt update, apt upgrade).

2.3. Optional: Overclock Raspberry Pi

Overclocking will allow us to maximize computational performance from the Raspberry Pi; however, it comes at the cost of significantly higher power draw and heat output. Only do this if using the Raspberry Pi with a strong cooler and a good power supply (as previously described). Install using:

sudo nano /boot/firmware/config.txt

Add the following text anywhere in the document (preferably at the beginning just after the header lines):

# overclock settings
over_voltage=6
arm_freq=2000
gpu_freq=750

Save and close the file. Reboot the Raspberry Pi by cutting power or:

sudo reboot -h now

Use the Raspberry Pi and check that the system is still stable with the applied overclock.

3. ROS Noetic installation

Following the installation instructions given at this link.

Setup your computer to accept software from packages.ros.org.

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

Set up your keys:

sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

Update apt and apt-get repositories:

sudo apt update
sudo apt upgrade
sudo apt-get update
sudo apt-get upgrade

Install ROS. This installs the full desktop version of ROS. Although The Raspberry Pi is not capable of running many of the packages in the full desktop version of ROS, installing the full version minimizes the chance of running into package dependency errors. If disk space is of significant concern, installing the bare bones version of ROS is an option.

sudo apt install ros-noetic-desktop-full

Remember that you must source your ROS setup.bash file for each new terminal instance:

source /opt/ros/noetic/setup.bash

Alternatively you can source ROS automatically via the .bashrc:

echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
⚠️ **GitHub.com Fallback** ⚠️