ROS 2 over Ethernet¶
The following tutorial explains how to connect a flight controller to a companion computer using ethernet for DDS communication.
Ensure you have ROS 2 installed and have run SITL successfully before attempting this page.
Additionally, make sure you understand the basics of networking in ArduPilot.
Motivation¶
Starting in ArduPilot 4.5, ethernet is now supported as a new communication interface. Compared to connecting an autopilot over serial, ethernet has the following advantages:
Ethernet is more immune to noise because it uses twisted pair wiring
Ethernet can run multiple protocols over the same protocol (unless you use PPP)
Ethernet is easier to debug with tools such as
tcpdump
orWireshark
Ethernet uses standard cabling, so it’s more difficult to mix up TX and RX
Physical Equipment¶
The following equipment is required to complete this tutorial:
A computer that can run the MicroROS Agent and the ROS 2 CLI
An autopilot with ethernet support
Necessary parameters for static configuration¶
This list of parameters is given as an example. If you had the following static IP addresses:
An autopilot has the IP address
192.168.1.6
A Computer running the MicroROS agent has the IP address
192.168.1.5
The MicroROS agent is running on port
2019
Then, you would configure all of the below parameters.
Parameter Name |
Value |
---|---|
1 |
|
192 |
|
168 |
|
1 |
|
6 |
|
2019 |
|
0 |
|
1 |
|
192 |
|
168 |
|
1 |
|
5 |
Modify the addresses to suit your needs; the rest can remain the same.
Steps¶
Flash the autopilot with software compiled with
--enable-dds
Connect the autopilot via ethernet to the computer
Open a MavProxy session
Configure the parameters described above, starting with the
ENABLE
parameters first.Reboot the flight controller
Start the MicroROS Agent with the same port as the parameter for
DDS_UDP_PORT
ros2 run micro_ros_agent micro_ros_agent udp4 -p 2019 -r dds_xrce_profile.xml
Use the ROS 2 CLI to interact with the autopilot