Home

Awesome

RIOT-ROS2

This project enables ROS2 to run on microcontrollers using the RIOT Operating System and the NDN protocol. More information about the design of this project is available in the wiki.

Package support

ROS2 is composed of several layers. Some have been modified to be able to run on microcontroller. Here is a summary of the main difference between the ROS2 stack and the RIOT-ROS2 stack :

LayerPackageROS2RIOT-ROS2
ROS Client Library bindingsrclc:heavy_check_mark::heavy_check_mark:
rclcpp:heavy_check_mark::x:
ROS Client Libraryrcl:heavy_check_mark::heavy_check_mark:
ROS MiddleWarermw_fastrtps:heavy_check_mark::x:
rmw_ndn:grey_question::heavy_check_mark:
ROS IDL Generatorsgenerator_c:heavy_check_mark::heavy_check_mark:
generator_cpp:heavy_check_mark::x:
ROS IDL Type Supportintrospection_c:heavy_check_mark::x:
introspection_cpp:heavy_check_mark::x:
cbor:grey_question::heavy_check_mark:
ROS IDL Interfacescommon_interfaces:heavy_check_mark::heavy_check_mark:
rcl_interfaces:heavy_check_mark::heavy_check_mark:

Examples

All examples should be able to handle any RMW implementation (see Usage).

std_msgs::String

std_msgs::Int32

Usage

Requirements

Ubuntu

sudo apt install cmake git python3-pip python3-empy g++-multilib
pip3 install vcstool

If pyparsing is not installed :

pip3 install pyparsing

If your arm-none-eabi-gcc is too old (< gcc 5) :

sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
sudo apt-get update
sudo apt install gcc-arm-embedded

Required for RIOT (native) :

sudo apt install libc6-dev-i386

Fedora

Required for ROS2 :

sudo dnf install cmake git python3-pip python3-empy python3-pyparsing
pip3 install vcstool
# if g++ is not already installed
sudo dnf install gcc-c++

Required for RIOT (native) :

sudo dnf install glibc-devel.i686

Others

Please, follow the requirements for ros2 official installation instructions.

Get the sources

mkdir -p ~/ros2_riot_ws/src
cd ~/ros2_riot_ws
wget https://raw.githubusercontent.com/astralien3000/riot-ros2/master/ros2.repos
wget https://raw.githubusercontent.com/astralien3000/riot-ros2/master/ament2riot.cmake
vcs import src < ros2.repos

Some downloaded package are not supported, you may run these commands to disable them :

touch src/ros2/rcl_interfaces/test_msgs/AMENT_IGNORE

Two build phase

ROS2 and RIOT have 2 very different build systems. To be able to use them together, you need to build applications in 2 steps : using Ament, as a ROS2 user would normally do (but in the case of cross compilation), and then compiling each application for it's target microcontroller with RIOT's Makefiles.

First phase :

cd ~/ros2_riot_ws
./src/ament/ament_tools/scripts/ament.py build --symlink-install --cmake-args -DCMAKE_TOOLCHAIN_FILE=`pwd`/ament2riot.cmake

After that, you can go to the second build phase.

Linux native 2nd build phase example

First, setup the tap interface :

./install/RIOT/dist/tools/tapsetup/tapsetup

On a first terminal :

(cd install/talker_c && make PORT=tap0 all term)

On a second terminal :

(cd install/listener_c && make PORT=tap1 all term)

Board to Linux example

This example have been tested with a samr21-xpro, but should work with any RIOT-supported board that can communicate via UART with a computer.

Setup the tap interface :

./install/RIOT/dist/tools/tapsetup/tapsetup

To flash the board, and enable the serial link :

(cd install/talker_c && make BOARD=samr21-xpro PORT=tap0 flash term)

To run the native application :

(cd install/listener_c && make BOARD=native PORT=tap1 all term)

The talker_c and listener_c apps should be seamlessly switchable between the board and native.

Troubleshooting

If this command fails :

> ./install/RIOT/dist/tools/tapsetup/tapsetup
creating tapbr0
RTNETLINK answers: File exists

Maybe it's because you already called it. It is not supposed to be called twice.

Try :

./install/RIOT/dist/tools/tapsetup/tapsetup -d