Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
199 lines (161 sloc) 5.42 KB

ros2arduino Build Status

Arduino library for communicating with ROS2(DDS)

Version-specific dependencies

  • Recommend version (present)
ros2arduino ROS2 Micro-XRCE-DDS Agent
0.1.1 Dashing Diademata 1.1.0

For the Micro-XRCE-DDS Agent, please install it using following commands.

$ git clone
$ cd Micro-XRCE-DDS-Agent && git checkout v1.1.0
$ mkdir build && cd build
$ cmake ..
$ make
$ sudo make install
$ sudo ldconfig /usr/local/lib/
  • All
ros2arduino ROS2 Micro-XRCE-DDS Agent
0.1.1 Dashing Diademata 1.1.0
0.0.9 Crystal Clemmys 1.0.1


Available boards (What we've tested on our own, RAM size >= 20Kb(OpenCM9.04))

Based on the normal behavior of publisher and subscriber.


Implemented Note
Serial YES
UDP YES ESP32, ESP8266, Ethernet
TCP NO Debugging...

Getting Start

Dependancy Installation

You must install ROS2 and XRCE-DDS Agent. (The version should be the same as the Version-specific dependencies above)

Upload Arduino sketch

  • [File] - [Examples] - [ros2arduino]
    • Serial
      • [publisher]
    • UDP
      • [publisher_wifi_udp]
      • [publisher_ethernet_udp]
    • TCP
      • [publisher_wifi_tcp]
      • [publisher_ethernet_tcp]
  • [Sketch] - [Upload]

Excute Micro-XRCE-DDS Agent

  • Please refer to eProsima manual for Micro-XRCE-DDS-Agent usage.

  • 0.1.0 or above (Micro-XRCE-DDS-Agent 1.1.0 or above)

    • Serial
      $ MicroXRCEAgent serial --dev /dev/ttyACM0 -b 115200
    • UDP
      $ MicroXRCEAgent udp -p 2018
    • TCP
      $ MicroXRCEAgent tcp -p 2018
  • 0.0.9 (Micro-XRCE-DDS-Agent 1.0.1)

    • Serial
      $ MicroXRCEAgent --serial /dev/ttyACM0 115200
    • UDP
      $ MicroXRCEAgent --udp 2018
    • TCP
      $ MicroXRCEAgent --tcp 2018

Check topic on ROS2

$ ros2 topic echo /arduino_chatter

Appendix: How to configure entities from reference file. (available at 0.1.1 or above)

  • Use the reference method supported by Client and Agent. Please refer to eProsima manual for detailed usage.
  • For this feature, You need to change the settings(code) in ros2arduino library.
  • In the user_config.h file, you must set the value of UXR_CREATE_ENTITIES_USING_REF to 1 like below.
#define USER_ROS2_PUBLISHER_MAX       10
#define USER_ROS2_SUBSCRIBER_MAX      10

For example, create .refs file(in XML format) and run the Agent with the following options:

$ MicroXRCEAgent serial --dev /dev/ttyACM0 -b 115200 -r ros2arduino.refs
  • ros2arduino.refs
    <participant profile_name="ros2arduino_xml_node">

    <data_writer profile_name="arduino_chatter">

    <data_reader profile_name="arduino_led">

    <topic profile_name="Bool">

    <topic profile_name="String">

Development Note

Lastest release

  • Feature
    • Only one node available
    • Publisher
    • Subscriber
  • Communication
    • Serial
    • UDP


  • Feature
    • ROS2 service
  • Communication
    • TCP (Debugging)
  • Enhancements
    • Memory allocation / Management
    • Reduce memory usages
    • Reusable API interfaces
    • Reasonable SW structure
You can’t perform that action at this time.