Emlid

Community Forum

How to improve UDP connection stability?


(antonvh) #1

When I setup ArduPlane on the RPi to broadcast over UDP, the connection works, but is very unstable. APM Planner says ‘connection lost’ after about 30 seconds. I have to hit disconnect and connect to open the connection again.

I’m using a wired ethernet connection to avoid wifi troubles. But the disconnections continue. I compiled ArduPlane from source, no improvement.

What can I do? I noticed APM Planner has a UDP client mode, but I can’t figure out how to start ArduPlane to broadcast for ‘client mode’ udp.


(Benedikt) #2

Hi Antonvh ,

if u can spare a little CPU usage on your raspberry you can look into mavproxy; its a nice tool to distribute APM data to multiple gcs or for reconnection after connection lost; connection to dyndns IPs etc;
http://qgroundcontrol.org/mavlink/mavproxy_startpage

But afaik UDP connection and APM planner should reconnect automatically without manual reconnection after a few seconds;
have u tried using another gcs?

PS:edited because of SchuermannSebastians comment - mavproxy #mavlink


(Sebastian) #3

Perhaps I get something wrong, but aren´t you confusing mavlink and mavproxy?
Communication with APM is always using the mavlink protocol, regardless of the medium.
Mavproxy is a lightweight GCS programmed in python.


(Benedikt) #4

Of course sebastian is right - its mavproxy; i can’t remember the details now - used it last August last time to forward APM to a dyndns-ip; will try to look into it again and try to give some further info asap…

PS!!! (I corrected link and mavlink-to-mavproxy in my former post - THX to Schuermannsebastian)


(Sebastian) #5

If you are using a Windows PC, I would use MissionPlanner. It has its quirks, too, but I found it to be much more reliable than APMplanner.
Are you really broadcasting the telemetry from the Navio? Normally you start the APM executable with the -A option and the IP address of the GCS computer. Broadcasting would mean, you send out the telemetry stream to all devices on your network, using x.x.x.255 as the IP address. I think this only works with something like socat, not with the APM executable directly.


(Igor Vereninov) #6

We have never experienced anything like that, UDP telemetry works without any issues. Maybe it is related to a specific Wi-Fi dongle? Please post more details about your equipment and how you run everything.


(antonvh) #7

Thanks for all the help. More specifics of my setup:

  • LAN wired connection to the Raspbery Pi model 2.
  • Pi has a Navio+ shield
  • Navio and Pi are powered via Lipo. Servor rail is powered via ESC.
  • Pi Runs “sudo ArduPilot -A udp:192.168.179.42:14550”
  • The IP address is the address of my Mac. It runs APM Planner 2.0.18
  • I also tried running socat on the Pi to broadcast the UDP packets to the whole subnet. This works, the GCS IP address doesn’t matter anymore, but still connection is lost after 30s.
  • Eventually I want to run this setup with a wifi access point on the Pi and a 3G stick for backup. I have the wifi access point working. But I eliminated the stick
    in my tests above to be sure that the access point wasn’t the problem.
  • I tried turning heartbeat on and off in APM planner.

Tonight I will try to run MavProxy on my Mac, on the Pi or on my NAS. See if anything is a solution. I also have a crappy old eeePc Windows Machine. I could try that one too.

Regards,
Anton.


(antonvh) #8

When running MAVproxy on my Mac I have no disconnects anymore. So the navio and the Pi are fine. The problem seems to be with APM Planner. I filed a bug report. Sadly Mavproxy doesn’t want to load graphical modules on the mac. Will try to install mavproxy in proxymode on the Pi and see if that works around the APM Planner issue.


(Vladimir Pozniy) #9

Did you find a way to get it working?

My 4G connection is unstable and I have crontab script checking connectivity every 30 seconds. If there is no ping to real GCS, I want to issue a GO_HOME command by GCS ran on localhost.

What GCS can I run on raspberry as a backup? DroneKit ? Any ideas would help.


(antonvh) #10

I use MAVProxy on all my devices. Not sure if that’s the best solution, but it works for me.