Step by step guide to Mavproxy on Windows 7 - Live forward your UAV data over network and the internet!

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

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.

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. 

Views: 6793

Comment by Alex Paskulin on May 19, 2014 at 1:49pm

Great work, Ben! Here's the wiki page: http://dev.ardupilot.com/wiki/mavproxy-on-windows-7/

Let me know if you'd like anything changed.

Best,

Alex

Comment by Dhruv Jain on May 21, 2014 at 3:51am

Hey Ben,

How did you send the data over 3G ?Which mission planner did you use? I could only send the data over same network by giving the ip of laptop connected under same network using QgroundControl.


100KM
Comment by Ben Dellar on May 21, 2014 at 8:02am

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.

Comment by Dhruv Jain on May 21, 2014 at 9:24am

Dear Ben,

Thanks for your reply, actually I want to use one PC (having internet connection through 3G)on which MAVproxy is set up to use as server and some other PC having internet connection(may be wifi or 3G) to receive that data.How should I do it then?


100KM
Comment by Ben Dellar on May 21, 2014 at 9:45am

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

Comment by Dhruv Jain on May 21, 2014 at 10:21am

Dear Ben,

Actually in real case there will be no local machine as we will use 3G to transmit the data to ensure long flight.So for  MavProxy works if I enter --out public IP address of the machine I want to forward the data to only when I have VPN between them.

One more thing sir, Do you have a method by which video transmission can be done over 3G and seen in mission panner (QgroundControl).


100KM
Comment by Ben Dellar on May 22, 2014 at 6:38pm

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.

Comment by Dhruv Jain on May 23, 2014 at 3:54am

Can anyone tell how to add mavelous module to mavproxy.I am getting error after following procedure given in the guide.

Failed to load module: No module named mavelous

Comment by Richard Horner on July 15, 2014 at 6:58pm

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.

Comment by Stefan Lane Hardy on September 25, 2014 at 8:01pm

I get an ImportError when I type in "mavproxy.py --master="com14" --baudrate 57600" in the command prompt in step 6.  I checked mavproxy.py and the script tries to import 4 files.  The ImportError says "cannot import rline." I went to the mavproxy directory to make sure rline was there, and it was, along with the three other imports (textconsole,mp_module, and dumpstacks).  However textconsole happens to be the only one it reads/imports. 

Has this happened to anyone else?  And does anyone know what's going on or how to fix it?

Comment

You need to be a member of DIY Drones to add comments!

Join DIY Drones

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service