100KM

3689594748?profile=original

MAVProxy is powerful ground station software that excellently complements your favorite GUI ground station, such as Mission Planner, APM Planner etc. A key driver for me to look into MAVProxy was it's capability to forward the signal from your UAV over the network via UDP to multiple other ground station software on other devices. For example; you can run a ground station on a laptop next to your antenna and forward via wifi to a smartphone/tablet which lets you easily relocate to launch into wind before heading back to your fixed antenna. I have also used it to send telemetry data to a friend acting as spotter several kilometers away (via 4G vpn) during a longer flight so that he could monitor the entire flight and determine where to look to find the aircraft in flight.

Alas it is not the easiest to understand how to run on Windows and I had no luck finding a single step by step guide for the non technical, so I have had a go at creating one. This guide will let you successfully set up MAVProxy to allow forwarding via network interfaces and usage via command line. There may be other ways to get this running and you may need other packages as per the official MAVProxy documentation at http://tridge.github.io/MAVProxy/ in order to use more advanced functions. No warranty responsibility for damage etc. Full credit to Andrew Tridgell and all other contributors to MAVProxy and the other software used here.

Step 1 - Check you can connect to your UAV

Before starting anything make sure you can make a direct connection to your aircraft with your normal Ground Station software on the PC in question. Check that you know the correct COM port and baudrate for the modem attached to your laptop as we will need that info later.

Step 2 - Install Python

Download and install Python 2.7 - Windows x86 MSI Installer works regardless of OS/CPU type. Install with default settings to C:\Python27\

Step 3 - Install Pyserial

Download and install Pyserial 2.7 - Win32 for Python 2.x (2.4...2.7) - Use default settings to the C:\Python27\ directory.

Step 4 - Install and set up MAVProxy

Download MAVProxy latest .tar.gz file and extract (Install WinRAR if you have no suitable archive extractor) to C:\Python27\

Once extracted you should be able to open up the path C:\Python27\MAVProxy-1.3.3\MAVProxy and see a file called mavproxy.py

Right click on mavproxy.py and select Edit with IDLE. On line 20 of the file remove the # in front of the line sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..')) so that it appears as below

3689594852?profile=original

Step 5 - Install pymavlink

Download pymavlink latest .tar.gz file and extract to C:\Python27\MAVProxy-1.3.3\MAVProxy

This will create a directory in the above folder called something like "pymavlink-1.1.29". Rename this folder to pymavlink.

Step 6 - Ready to run!

Check your radio modem is connected via USB, the aircraft modem and APM are powered and ensure any other ground station software is closed.

Open a command prompt window (Click start, type cmd and then press enter) and then enter cd "C:\Python27\MAVProxy-1.3.3\MAVProxy" and push enter. The command prompt will open that directory.

Then type mavproxy.py --master="com14" --baudrate 57600 (replacing the com port and baudrate with your local modem settings) and then push enter.

If everything has worked you should see MAVProxy start up and some basic flight data such as mode and current waypoint appear. Occasionally some data does seem to result in glitching and odd characters appearing onscreen but this does not seem to affect reliability or performance.

3689594865?profile=original

Enter a command such as mode FBWA  and press enter. You should see MAVLink report the mode change and notice your aircraft change behavior into that mode.

The full list of MAVLink commands can be found here if you want to experiment further with the command line.

To exit MAVLink press Control+C together.

Step 7 - Forwarding over network

To forward the MAV data over the network including to a local program on your PC we simply need to add some extra parameters when starting MAVProxy via the command line. 

To connect with a local ground station software such as Mission Planner start MAVProxy as above with the command mavproxy.py --master="com14" --baudrate 57600 --out 127.0.0.1:14550 and press enter.

Then open Mission Planner and select UDP and click connect. Clink OK on the default prompt for port number (14550) and you should see mission planner start downloading parameters and connecting to your UAV.

Finally you can add the IP address of any computer to forward the telemetry stream onwards to other ground stations.

1) On the local network/wifi you will need to ensure there is no firewall on the client PC stopping the incoming stream to your ground station software.

2) Add --out IP_ADDRESS:14550 to the end of the mavproxy.py command. You can add as many separate --out parameters as you want depending on how many extra ground stations you are running.

3) Set each ground station to listen for UDP packets on port 14550

Step 8 - Simple startup using a batch file

To simplify the starting up of MAVProxy I have written a simple 5 line batch file:

 Mavproxy Startup Batch File

You should edit this to reflect your local port, baudrate and include any additional IP addresses to forward the data to.

Simply save this anywhere and double click to start MAVProxy (assuming you have followed the instructions above).

I really hope this is helpful to some people. It took me a while to figure it out and hope my learning experience can benefit others. 

E-mail me when people leave their comments –

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

Join diydrones

Comments

  • Ben,

    Thank you for this post it has saved me hours of work over the last month. I am almost complete on a project to create my own MAVproxy module. The module uses OpenCV to detect a face in the images streamed from my quad and then instructs it to "Land". It works on the ground, but need to fly it and see what happens as expect the vibrations to create major issues. For speed of development I use Wi-Fi to stream the video from an old Android phone on the quad to the same computer they flies the quad over Telemetry only. This way I get an 'autonomous' quad without the head ache of trying to physically integrate with the APM.

  • 100KM

    Hi Dhruv,

    I understand now you want the aircraft to have 3G onboard and send telemetry via that. There are lots of options but my reading suggests three main options

    1) Use an off the shelf product such as dronecell

    2) Use a serial to wifi adaptor with a small personal wifi hotspot to stream the data over the internet

    3) Use a small linux computer onboard running MAVProxy (see instructions such as http://dev.ardupilot.com/wiki/odroid-via-mavlink/) - This would be my personal preferred option as it gives you maximum flexibility with setup and doesn't rely on another 2.4GHz wireless link within the aircraft.

    Maybe join and have a read of Telemetry over cellular IP group here on DiyDrones as there are lots of members experimenting here.

  • 100KM

    Hi Dhruv,

    A VPN/Hamachi will let you do exactly that. If you have a VPN between the two computers and follow the instructions from the original post using the --out parameter with the IP address of the remote machine it will allow you to run a remote ground station via 3G/internet. I would always recommend to also forward to the local machine and run GS software there to ensure you can control the aircraft directly in case of a problem with the internet or VPN.

    Cheers

    Ben

  • 100KM

    Thanks for the inclusion in the wiki Alex - will keep track of how things go and let you know of any updates required.

    Dhruv - the best option IMO is to use a VPN. Any will do but I used Hamachi (free) as it is super simple to set up (no port forwarding etc). Simply install Hamachi on both PCs and connect them to the same network name. This allows them to connect direct over secure VPN as if they are on the same LAN. Then tell MAVProxy on the main PC to forward the signal both the local GS (127.0.0.1) and the Hamachi IP address (typically something like 25.XX.XX.XX) of the remote PC and have that one listen for UDP. This should work with any ground station software that can listen for a UDP MAVLink stream but I have successfully used in flight with 2 instances of Mission Planner.

  • 100KM

    Hi Tridge,

    Sounds like a good option to me and a really useful feature to add. With the increasingly low cost to put linux PCs in planes (and possibility of APM running direct on Linux ) I am keen to experiment with on board 3G etc which will probably use MAVProxy extensively. Let me know how I can help if at all - have a basic understanding of coding and am keen to help out with real world testing also.

    Ben

  • Developer

    Ben,

    What I'm planning on doing is making the --out code be an alias for a "connect" command, something like:

     connect output 127.0.0.1:14550

    we could add options like this:

     connect output 127.0.0.1:14550 ro

    I'd suggest we do it as a new module (modules/mavproxy_connect.py) then just have some helper functions to add/remove connections in the mainline code.

    Cheers, Tridge

  • 100KM

    Thanks for the clarification Tridge,

    I was reading those lines of code and had to double check again on my aircraft HW just now, you can definitely send commands to the UAV from a GS using the --out feed. I have also flown it in this configuration several times. Being completely new to python and OS contribution I have skimmed the MAVProxy code and may try and figure out how to add something like an --out_readonly parameter in a fork for testing. 

    In the mean time to achieve read only and read/write forwarding if desired you could actually run two instances of MAVProxy one with mavfwd enabled in mavproxy.py forwarding to the read/write ground station and also forwarding to another instance of MAVProxy with mavfwd disabled. The second instance could then forward to all the read-only terminals if desired. It's a somewhat heavy handed solution but should work.

    Stephen you are 100% correct regarding MAVProxy dependencies, these instructions only cover the setting up of command line and network forwarding.

  • Developer

    Hi Stephen,

    Forwarded connections started with --out are bi-directional by default. The mavfwd setting allows you to make them read-only. The code should perhaps make it clearer, but it does work in both directions.

    The only packets that are not forwarded by default are the stream rate packets, as otherwise multiple GCS instances would fight over the stream rates. You can ask for those to be forwared too by setting mavfwd_rate to 1.

    Cheers, Tridge

  • Ben: At this point, the current source shows that all "--out" connections are readonly (see mavproxy.py, lines 1171-1177). This is a recent change, so I'm not sure when it will be uploaded to pypi. There's no way to make it on a per-out basis though.

    MAVProxy also comes with many GUI modules which require additional dependencies. The extra dependencies are listed at http://tridge.github.io/MAVProxy/

  • 100KM

    Pleased to hear this is useful - do I need to do anything regarding the wiki as it doesn't seem like a traditional one that anyone can edit?

    Pedals - the setup described above allows all connect ground stations to send and receive any command to the UAV. I am interested in investigating if MAVProxy can be configured to only accept commands from specific ground stations in order to allow "view only" terminals to be set up for spotters/spectators etc.

This reply was deleted.