How micro-ros/micro_ros_arduino works
Project Type and Purpose
• This is an embedded client-side library (“micro-ROS for Arduino”) that lets Arduino sketches participate as ROS 2 nodes.
• It provides a pre-compiled cross-platform C library wrapping ROS 2 client APIs (rcl, rclc) and the RMW transport (microxrcedds), plus message/service definitions.
High-Level Architecture Components
a. User Application (Arduino Sketches)
• Reside in examples/* or user projects
• micro_ros_arduino.h and call the micro-ROS client API (publishers, subscribers, services, actions)
b. micro-ROS Arduino Library
• Precompiled .a libraries under src/<board>/libmicroros.a (e.g. cortex-m4/libmicroros.a)
• Exposes a thin Arduino-friendly wrapper over:
• rcl (ROS 2 client library, nodes, publishers, subscribers)
• rclc (convenience C API over rcl)
• rmw_microros (transport binding layer)
• rmw_microxrcedds_c (lightweight XRCE-DDS implementation)
• uxr (XRCE-DDS client core for serialization, session, streams)
• rcutils, rosidl_runtime_c, rosidl_typesupport_* (message type support)
c. Transport Layer
• Default serial transport (default_transport.cpp)
• Optional Ethernet or Wi-Fi transports (native_ethernet_transport.cpp, wifi_transport.cpp)
• Implements physical I/O to the host running the micro-ROS Agent
d. micro-ROS Agent (out of repo, Docker container)
• Runs on a PC/RPi, presents a middleware bridge
• Talks to the embedded XRCE client over serial/TCP/UDP
• Bridges XRCE-DDS packets to native ROS 2 (DDS) topics/services, making the Arduino board appear as a regular ROS 2 node
e. ROS 2 Core
• DDS network, other ROS 2 nodes, tooling (rviz, ros2 topic, etc.)
Component Relationships & Data Flow
• The Arduino Sketch invokes publisher/subscriber APIs → links to
• micro-ROS Library Layers (wrapper → rcl/rclc → rmw_microros → rmw_microxrcedds) → hands off serialized messages to
• uxr Client → uses Transport (serial / Ethernet / Wi-Fi) over USB/UART or network → lands on
• micro-ROS Agent process → forwards packets over DDS → to ROS 2 Core
Architectural Patterns & Principles
• Layered Abstraction: application → client API → middleware → transport
• Separation of Concerns: transport is pluggable (serial vs. Ethernet vs. Wi-Fi), application code remains unchanged
• Client-Server: the embedded board is an XRCE-DDS client; the Agent is the server/gateway
• Cross-Compilation / Meta-Build: extras/library_generation uses CMake meta files (colcon_*.meta) to produce per-board static libraries
Technologies & Frameworks
• CMake / Docker (for library generation)
• Arduino IDE / CLI / PlatformIO (to compile sketches)
• eProsima Micro XRCE-DDS (lightweight DDS)
• ROS 2 client libraries (rcl, rclc, rcutils)
• Arduino cores for various MCUs (Cortex-M, ESP32, Teensy, etc.)