Saturday, 11 January 2014

Sending bi-directional data from serial port across UDP

One small issue on the glider.
How do I send data between the APM and the ground station economically.
I originally was using a TCP connection (ser2net) but was having issues with packet loss and connection drop outs. This  was a problem as each time I would have to reconnect and initialise the link. Not a good thing whilst flying.

So after a bit of research I have moved over to socat. One command and the link is up :)
scocat UDP-LISTEN:5761 /dev/ttyACM0,raw

So what does this do, it sets up a UDP server on port 5761 that is connected to the serial port ttyACM0.
This allows the ground control software to talk to the APM directly and if packets are drop,missing or wrong order they are ignored.
If this was TCP then each of these errors would cause a resend for the point at which the error occurred