Morgan Quigley
OSRFRed: x86
Green: MCU's
Blue: FPGA's

Goal #1: standardize wire protocols
to allow generic toolingGoal #2: eliminate driver-nodes and push somereal-time processing out to the sensors● Modern MCU's are fast!
● Real-time can be easier on small systems!

8/16-bit MCU

32-bit MCU

ARM A-class

SFF x86

smartphone without screen

laptop without screen

Example Chip

Atmel AVR

STM32

Samsung Exynos

Intel Core i5

Example System

Arduino Leonardo

Pixhawk PX4ODROID

Intel NUC

MIPS

10's

100's

1000's

10000'sRAM

1-32 KB4-256 KB

a few GB (off-chip)

2-16 GB (SODIMM)

Max power

10's of mW

100's of mW

1000's of mW

10000's of mW

Comms peripherals

UART, USB FS, ...

USB HS, Ethernet

Gigabit Ethernet

USB SS, PCIe

Future work

This talk"normal" ROS2

Large price/performance tradeoff, even within this category"small" 32-bit MCU"big" 32-bit MCUCore

ARM Cortex-M0

ARM Cortex-M7

Speed

48 Mhz300 Mhz

RAM

32 KB

384 KB

Flash256 KB

2048 KB

Cost @ 1K units$2$10Comms

USB FS

Ethernet, USB HS

Future work

This talk• startup sequencing• XML-RPC discovery◦ parse XML trees• TCP data streams• UDPROS not complete◦ no multicast◦ no fragment retries◦ no "latched" topics

embedding becomesvery difficult!

• no master• multicast UDP Discovery◦ parse parameter lists• RTPS/UDP data streams• extensive QoS on UDP◦ TCP-like◦ "fire and forget" UDP◦ everything in between

goal: show thesebenefits with free,portable, small code.

• Apache2 License• RTPS (transport) and CDR (serialization)• work in progress! WARNING WARNING• can use on MCU's and on LinuxFreeRTPS User API
portable discovery, serialization, etc.
minimalist UDPv4
STM32
Ethernet

SAM
Ethernet

POSIX UDPv4

• Comms with ROS2 only needs RTPS !
• Don't need all of DDS, nor every possible QoS
flexible library stack,elegant API via C++
user code
rclcpprmw

minimalist library stack,ugly API, C-onlydds interface

user code

OpenSplice et. al.

FreeRTPS• Buffer needs for RTPS discovery andcommunications are predictable• All-static (compile-time) allocation is possible!
◦ Node discovery buffers◦ Topic discovery buffers◦ Message send/receive buffers• FreeRTPS currently does not use the heap

◦ Tradeoff: finite number of nodes can be discovered• Minimal proof of concept: sending RTPS strings◦ same as ROS2 std_msgs::msg::String• Node is all-static (no malloc, etc.)◦ RAM: ~100 KB◦ Flash: ~60 KB• many potential size reductions are possible
FreeRTPS Talker
Runs on POSIX, STM32F4,
STM32F7, Atmel SAM V71

RTPS

OpenSplice Listener#include <stdio.h>#include "freertps/freertps.h"#include "std_msgs/string.h"
struct std_msgs__string msg;
char data_buf[64];uint8_t cdr[68];

Static buffers foruserland message
and its serialization

void main(int argc, char **argv){
freertps_init();freertps_pub_t *pub = freertps_create_pub("chatter", std_msgs__string__type.typename);
freertps_start();msg.data = data_buf;
int pub_count = 0;
while (true){
freertps_listen(500000);
freertps_disco_tick();
snprintf(msg.data, sizeof(data_buf), "Hello, world! %d", pub_count++);int cdr_len = serialize_std_msgs__string(&msg, cdr, sizeof(cdr));freertps_publish(pub, cdr, cdr_len);printf("sending: [%s]\r\n", data_buf);}}tick the discovery
machinery periodically

stuff, serialize, andsend the message

• IMU demo via STM32F4-Discovery:◦ sends sensor_msgs::Imu @ 1 KHz◦ 100 KB RAM, 60 KB Flash• Camera demo via Atmel SAM V71 Xplained:◦ sends sensor_msgs::Image @ 30 Hz◦ 380 KB RAM (framebuffer), 60 KB Flash• Actuator (just an LED) on various boards:◦ subscribes to std_msgs::Bool• STM32F4-Discovery stack: $55• Slightly modified to use both
Ethernet PHY and IMU• Goal: measure FreeRTPS jitter• Accelerometer CS andEthernet TXEN signals
to Agilent DSO-X 3034A

IMU CS
Ethernet TXENIMU CS
Ethernet TXEN
Ethernet RXDVIMU CS
Ethernet TXEN
Ethernet RXDVtime calculation

ROS2 / DDS / RTPS is much more embeddedfriendly than the ROS1 protocols• more MCU's, especially smaller ones!
• other physical layers (via standardizedgateways), using abbreviated net/RTPS
headers:◦ USB: FS, HS, SS◦ RS485, TTL UARTs of various bitrates◦ 802.15.4 and other wireless radios