Canonical's Jeremie Deray has published a guide to getting up and running with micro-ROS, a project designed to bring the Robot Operating System 2 (ROS 2) to microcontrollers, on the low-cost Raspberry Pi Pico.
Recently ported to Arduino's Portenta H7, micro-ROS is designed to bridge the gap between low-resource microcontrollers and more powerful systems-on-chips running ROS 2. Swapping out the Linux kernel for a lightweight real-time operating system (RTOS), micro-ROS integrates seamlessly with ROS 2 — and can now be installed on the $4 Raspberry Pi Pico's RP2040 microcontroller.
"We will see how the Raspberry Pi Pico can natively speak to a ROS 2 graph using micro-ROS," Canonical's Deray writes by way of introduction to his step-by-step getting started guide. "We will set up a project in VSCode, compile and upload it to the microcontroller. We thus assume that you are somewhat familiar with ROS 2 development and VSCode."
"Let’s break down very briefly what the example does. It sets up a node called
pico_node, then a publisher publishing a
std_msgs/msg/int32.h message on the topic
pico_publisher, a recurring timer and an executor to orchestrate everything. Every 0.1 second, the executor spins. But only every second, the timer will have the publisher publish a message and increase the message data by 1. Simple."
The full tutorial, which can be carried in Ubuntu Linux directly or via an LXD container, is now available on the Ubuntu blog.