ArduPilot now has good support for TCP/IP over ethernet, both in SITL and on real hardware for flight controllers that have an ethernet connector.
The above picture shows 3 flight controllers that have been tested, all connected to a botblox ethernet switch via the botblox cable adapter boards. The 3 flight controllers from left to right are:
- a CubePilot CubeRed
- a CUAV Pixhawk V6X
- a Holybro Pixhwk6X
For the botblox devices see Products - Standard Series - BotBlox and search for ArduPilot.
These flight controllers all come with ethernet ports. The Holybro and CUAV boards use a 4 pin JST-GH 1.25 mm connector, the CubeRed uses a 5 pin JST-GH 1.25mm connector. The adapter boards from botblox allows you to cross-connect them, so in this photo the 3 flight controllers are all connected to the same ethernet switch, and also connected via a standard ethernet patch cable to my laptop.
What you can do
With the latest ArduPilot firmware installed (4.5.x developer branch) you can do the following:
- confgure the board with a static IPv4 address, or enable the DHCP client for automatic addressing
- configure a gateway for access to other subnets
- configure up to 4 network ports which can be configured for any of the serial protocols supported by ArduPilot in the SERIALn_PROTOCOL options (currently 45 protocols available)
- for each port, configure it as one of 6 TCP/IP transport types, UDP client, UDP server, TCP client, TCP server, UDP multicast or UDP broadcast
Setting up for networking
Once the hardware is setup you should set NET_ENABLED to 1 and then reboot. This will enable a new parameter tree with the networking parameters.
In the above setup I have the flight controllers IP set to 192.168.13.14 and I have my laptop at 192.168.13.15. I’m not using DHCP in this example. You will need to reboot after seting up your network addresses.
Next, test it with the ping command to make sure you have good connectivity.
Now you can setup some network ports. Here is the setup of the first network port to use UDP unicast to my laptop:
I’ve set the protocol to 2 for MAVLink2 as I want to connect a ground station on UDP and I’ve set it to send to UDP port 15001. I could just as easily connect any of the 45 serial protocols we support in ArduPilot (eg. NMEA out, R/C, gimbal devices etc).
You can similarly configure up to 4 network ports with NET_P1 to NET_P4. You can set the type to 1 for UDP client, 2 for UDP server, 3 for TCP client and 4 for TCP server.
For UDP broadcast and multicast you just set it as UDP client then set the target IP address appropriately. For UDP broadcast set it to 255.255.255.255. For UDP multicast you need to set an IP in the IPv4 multicast range.
We also support TCP/IP for ROS2 DDS. @rfriedman has been working hard on DDS support and we expect to have it available for builds on the custom build server soon with full network support.
We will soon be adding lua scripting bindings for networking which will open up a lot of interesting possibilities, such as a web server and lua scripts making snmp calls.
To join in the development discussions please join the ethernet channel on ArduPilot discord server
I’d also like to give a big thank you to @MagicRuB and @bugobliterator for all their work on ethernet support in ArduPilot. It has taken a while, but we are really pleased with the result.
I hope this helps users get started with ethernet on ArduPilot!