Building ROS2 for the RPi ZW

A project log for Roomba RPi

iRobot Roomba 690 enhanced with a Raspberry Pi Zero 2W and IMU.

Josh GadekenJosh Gadeken 07/26/2021 at 03:310 Comments

"ROS 2 Foxy Fitzroy Artwork" by Open Source Robotics Foundation is licensed under CC BY-NC 4.0

Manually building ROS 2 [1] for the Raspberry Pi Zero W is necessary because Debian 10 Buster is a tier 3 platform [2]. This means that there are no officially built Debian 10 packages available.

The RPi ZW's CPU is the BCM2835, which is an ARMv6 based CPU [3]. The Debian (and Ubuntu) armhf port does not support this CPU, and the armel port has poor floating-point performance [4]. Additionally, arm32 support in ROS is also tier 3 [2], so one couldn't simply use the ROS Ubuntu ARM packages (they are arm64 anyway).

Debian does provide ARM cross-compilation tools, however they do not support the RPi ZW's CPU. Debian's `arm-linux-gnueabi-gcc` can produce binaries that run on the RPi ZW, but it does not support the VFP2 (Vector Floating Point) hardware extension of the RPi ZW's CPU (software floating point operations only) [5]. Debian's `arm-linux-gnueabihf-gcc` is built with VFP3 support, but it's for the ARMv7 [6], hence the need to build the cross-compiler toolchain from source. ROS has a cross-compiler toolchain, but like Debian's, it does not support the RPi ZW's CPU [7].

The steps to set up a cross-compilation toolchain and build ROS 2 for the RPi ZW are detailed in roomba-rpi/docs/