Hi,

Is it possible to connect UgCS to ArduPilot using UDP and MAVProxy?

MAVProxy can enable connection to multiple ground stations using the --out parameter:

MAVProxy --master=tcp:127.0.0.1:5760 --out=udp:127.0.0.1:14550 --out=udp:127.0.0.1:14551

With this connection method, a GCS can listen to UDP messages on port 14550 and communicate with MAVProxy once a message is received. This method works with MissionPlanner, QGroundControl, DroidPlanner/Tower, etc.

I tried modifying vsm-ardupilot.conf by setting:

vehicle.ardupilot.udp.1.udp_local_port=14550

But got the following exception:

"Specified key not found: vehicle.ardupilot.udp.1.udp_port"

I tried setting the udp_port and udp_address parameters (even though there is no server to connect to), but then I just get the following messages:

New connection [127.0.0.1:14556->0.0.0.0:14550:0].

Mavlink not detected on stream [remote: 127.0.0.1:14556].

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • Matt,

    Thanks for your interest.

    It is possible to make mavproxy+UDP to work with UgCS but it is somewhat involved.

    UgCS can connect to autopilot via UDP only if you know the remote address and UDP port of the vehicle (or mavproxy) in advance and specify it in vsm-ardupilot.conf file.

    The problem is to specify the proxy source UDP port because it changes on every launch of mavproxy.

    This means you need to:

    1) launch mavproxy

    2) use tcpdump or wireshark to get the udp source port mavproxy is using to send the mavlink data. (vehicle_udp_port)

    3) edit the vsm-ardupilot.conf and specify that port in "vehicle.ardupilot.udp.1.udp_port = <vehicle_udp_port>"

    4) restart the Ardupilot VSM in UgCS.

    I managed to make the socat scenario with two tcp listeners to work, so that could be your temporary workaround.

    Please send us your vsm.conf and mavproxy and socat commands, so we can help you to get this working.

    We are working on UDP connection autotedection and also on incoming TCP. It will be available in the upcoming releases. Then UgCS will be able to connect directly to mavproxy automatically.

  • Hi Artūrs,

    I know this is a bit of an old post, but I'm trying to solve the same problem (APM over UDP) and I'm interested in any solution that may be available.

    It looks like the "connect to" port for MAVLink/APM is actually the source port on the UDP broadcasts from the autopilot, so it doesn't look like there's a good way to configure that in the VSM.

    The problem appears to be that mavproxy's --out option wants to connect to a listening server and the VSM's TCP option also wants to connect to a listening server.  I tried connecting using socat:

    mavproxy.py --out=tcp:127.0.0.1:6556
    socat TCP-LISTEN:6554 TCP-LISTEN:6556

    and then configuring the VSM to connect via tcp to localhost:6554, but I still see "Mavlink not detected on stream" in the log.

    I also tried using socat to create a pty to see if ugcs could open as if it were a tty:

    mavproxy.py --out=tcp:127.0.0.1:6554
    sudo socat TCP-LISTEN:6554 PTY,link=/dev/ttyACM0,b115200,raw,echo=0,crnl

    I saw nothing in the logs for that port--I'm guessing ugcs tries to open the device and finds that it's not really a serial port and moves on.

    I suppose another solution may be to have mavproxy write to a serial port with a null modem connection back into another serial port, but it feels like I'm missing an obvious solution.


    Artūrs said:

    Hi Gary,

    Could You please send me these two files, that should help us understand the issue:

    vsm-ardupilot.conf and vsm-ardupilot.log to my e-mail: arturs.kalis@ugcs.com

    Meanwhile I may recommend You using TCP or Com port.

    Artūrs

  • Just to let you know we will get with more detailed answer. Need to get those always busy hardcore tech guys from the 3rd level of basement out in the sun to get it right!

    • Thanks! Don't forget the sunglasses :-)

      Apparently pymavlink (a library used in MAVProxy) was recently updated with an additional "tcpin" option, which basically solves this issue (I can connect to MAVProxy using TCP). The new version is not released yet, just the source code.

      It would still be nice to have UDP support.

      Thanks again!

    • Hi Gary,

      Could You please send me these two files, that should help us understand the issue:

      vsm-ardupilot.conf and vsm-ardupilot.log to my e-mail: arturs.kalis@ugcs.com

      Meanwhile I may recommend You using TCP or Com port.

      Artūrs

This reply was deleted.