Arduino library for communicating with ROS2(DDS)
ros2arduino | ROS2 | Micro-XRCE-DDS Agent |
---|---|---|
0.2.1 | Dashing Diademata Patch6 | 1.3.0 |
For the Micro-XRCE-DDS Agent, please install it using following commands.
$ git clone https://github.com/eProsima/Micro-XRCE-DDS-Agent.git
$ cd Micro-XRCE-DDS-Agent && git checkout v1.3.0
$ mkdir build && cd build
$ source /opt/ros/dashing/setup.bash # to share libraries with ros2
$ cmake ..
$ make
$ sudo make install
$ sudo ldconfig /usr/local/lib/
ros2arduino | ROS2 | Micro-XRCE-DDS Agent |
---|---|---|
0.2.1 | Dashing Diademata Patch6 | 1.3.0 |
0.1.4 | Dashing Diademata Patch3 | 1.1.0 |
0.1.3 | Dashing Diademata Patch3 | 1.1.0 |
0.1.2 | Dashing Diademata Patch1 | 1.1.0 |
0.1.1 | Dashing Diademata | 1.1.0 |
0.0.9 | Crystal Clemmys | 1.0.1 |
Implemented | Note | |
---|---|---|
Serial | YES | |
UDP | YES | ESP32, Ethernet |
TCP | NO | Debugging... |
You must install ROS2 and XRCE-DDS Agent. (The version should be the same as the Version-specific dependencies above)
Please refer to eProsima manual for Micro-XRCE-DDS-Agent usage.
0.2.1 or above (Micro-XRCE-DDS-Agent 1.3.0)
$ MicroXRCEAgent serial --dev /dev/ttyACM0 -b 115200
$ MicroXRCEAgent udp4 -p 2018
$ MicroXRCEAgent tcp4 -p 2018
0.1.0 ~ 0.1.4 (Micro-XRCE-DDS-Agent 1.1.0)
$ MicroXRCEAgent serial --dev /dev/ttyACM0 -b 115200
$ MicroXRCEAgent udp -p 2018
$ MicroXRCEAgent tcp -p 2018
0.0.9 (Micro-XRCE-DDS-Agent 1.0.1)
$ MicroXRCEAgent --serial /dev/ttyACM0 115200
$ MicroXRCEAgent --udp 2018
$ MicroXRCEAgent --tcp 2018
$ ros2 topic echo /arduino_chatter
Use the reference method supported by Client and Agent. Please refer to eProsima manual for detailed usage.
For this feature, you need to set UXR_CREATE_ENTITIES_USING_REF
definition to 1
.
#define UXR_CREATE_ENTITIES_USING_REF 1
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
<profiles>
<participant profile_name="ros2arduino_xml_node">
<rtps>
<name>ros2arduino_basic_node</name>
<builtin>
<domainId>0</domainId>
</builtin>
</rtps>
</participant>
<data_writer profile_name="arduino_chatter">
<topic>
<kind>NO_KEY</kind>
<name>rt/arduino_chatter</name>
<dataType>std_msgs::msg::dds_::String_</dataType>
<historyQos>
<kind>KEEP_LAST</kind>
<depth>10</depth>
</historyQos>
</topic>
</data_writer>
<data_reader profile_name="arduino_led">
<topic>
<name>rt/arduino_led</name>
<dataType>std_msgs::msg::dds_::Bool_</dataType>
</topic>
</data_reader>
<topic profile_name="Bool">
<kind>NO_KEY</kind>
<name>Bool</name>
<dataType>std_msgs::msg::dds_::Bool_</dataType>
</topic>
<topic profile_name="String">
<kind>NO_KEY</kind>
<name>String</name>
<dataType>std_msgs::msg::dds_::String_</dataType>
</topic>
</profiles>
This method should be preceded by the function described in "Appendix: How to configure entities from reference file."
And please check eProsima's manual for how to use it.