ROS 2 Humble on Raspberry Pi 5 Running Ubuntu 23.10
Introduction
While attempting to try out ROS 2 on the recently released Raspberry Pi 5, I quickly ran into trouble. Firstly, there will be no support for Ubuntu 22.04 on Raspberrypi 5. However, downgrading the OS is not possible as there is no ROS 2 support for Ubuntu 23.10. This means that the alternatives are to either use docker, or build from source.
If one tries to boot a Raspberry Pi 5 using Ubuntu 22.04, startup will be blocked, and it will say that OS is not supported, suggesting the modify the config.txt
with check_os=0
. This approach is not recommended as it will involve disabling other options as well, and devices like GPU and GPIO may not work properly.
While it is recommended to use docker, in this post I will outline how I managed to build ROS 2 Humble on Raspberry Pi 5.
Setup
First, you need to have Ubuntu 23.10
installed. One can follow the instructions here to install Ubuntu 23.10
onto the Raspberry Pi 5.
Build
After installing Ubuntu 23.10
, boot up the Raspberry Pi 5 device. The steps in this following section is adapted from Humble Ubuntu (Source).
Check Locale
As long as the first command, locale
outputs something with UTF-8
, you should be good to go and can skip to the next step.
locale # check for UTF-8
sudo apt update && sudo apt install locales
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8
locale # verify settings
Add the ROS 2 apt repository
# enable ubuntu universe repository
sudo apt install software-properties-common
sudo add-apt-repository universe
# add ROS 2 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
# Add repository to sources list
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 jammy) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
$(. /etc/os-release && echo $UBUNTU_CODENAME)
, $(. /etc/os-release && echo jammy)
is used. This is because there is no ROS 2 for mantic
(Ubuntu 23.10).At this stage, one can attempt to try to install ros-humble-desktop
from apt
. However, you’ll run into problems because Ubuntu 23.10 ships with Python 3.11, while Humble uses Python 3.10… Downgrading is not recommended.
Install development tools and ROS tools
sudo apt update && sudo apt install -y \
python3-flake8-docstrings \
python3-pip \
python3-pytest-cov \
ros-dev-tools
sudo apt install -y \
python3-flake8-blind-except \
python3-flake8-builtins \
python3-flake8-class-newline \
python3-flake8-comprehensions \
python3-flake8-deprecated \
python3-flake8-import-order \
python3-flake8-quotes \
python3-pytest-repeat \
python3-pytest-rerunfailures
ros-dev-tools
, check that /etc/apt/sources.list.d/ros2.list
is properly populated.Get ROS 2 code
mkdir -p ~/ros2_humble/src
cd ~/ros2_humble
vcs import --input https://raw.githubusercontent.com/ros2/ros2/humble/ros2.repos src
Install dependencies using rosdep
This may take about 0.5 hours to complete.
sudo apt upgrade
sudo rosdep init
rosdep update
rosdep install --from-paths src --ignore-src -y --skip-keys "fastcdr rti-connext-dds-6.0.1 urdfdom_headers" --os=ubuntu:jammy --rosdistro=humble
--os=ubuntu:jammy
). Further, we have to also tell it to look for ROS 2 Humble (with --rosdistro=humble
).Build
At this point you can try to build. This step may take more than 1.5 hours to complete. Also ensure that you do not have source /opt/ros/${ROS_DISTRO}/setup.bash
in your .bashrc
.
cd ~/ros2_humble/
colcon build --symlink-install
In my case, for currently unknown reasons, there might be build errors with datatypes like uint32_t
and uint64_t
. This can be fixed by adding #include <cstdint>
to the following files:
~/ros2_humble/src/src/ros2/rcpputils/include/rcpputils/filesystem_helper.hpp
~/ros2_humble/src/ros-tooling/libstatistics_collector/include/libstatistics_collector/moving_average_statistics/types.hpp
~/ros2_humble/src/ros2/rosbag2/rosbag2_compression/include/rosbag2_compression/compression_options.hpp
Test
Pub Sub
First Window (talker)
. ~/ros2_humble/install/local_setup.bash # source if needed
ros2 run demo_nodes_cpp talker
Second Window (listener)
. ~/ros2_humble/install/local_setup.bash # source if needed
ros2 run demo_nodes_py listener
You should be able to see the talker
staying it is publishing messages, and the listener
saying “I heard” messages.
RViz2
RViz2 not run out of the box and segfaults upon running (something about unable to create the rendering window after 100 tries). On a relatively clean install, you may be using the default wayland, and OGRE does not support that. Hence, we have to ‘force’ the use of x11
. This can be done by running the following instead of directly running rviz2
.
. ~/ros2_humble/install/local_setup.bash # source if needed
QT_QPA_PLATFORM=xcb rviz2
Conclusion
In this post, I’ve demonstrated how to build ROS 2 Humble on Ubuntu 23.10 on Raspberry Pi 5. Though it compiles, I’ve yet to throughly use this set-up to comment on the stability and viability of this approach. Perhaps using the docker approach is not that bad afterall…
Comments or discussions may be posted here.