MAVProxy

MAVProxy is a fully-functioning GCS for UAV's. The intent is for a minimalist, portable and extendable GCS for any UAV supporting the MAVLink protocol (such as the ArduPilotMega).

  • It is a command-line, console based app. There are plugins included in MAVProxy to provide a basic GUI. For a GUI that works on tablets, see the Mavelous project.
  • It is written in 100% Python.
  • It is open source.
  • It's portable; it should run on any POSIX OS with python, pyserial, and select() function calls, which means Linux, OS X, Windows, and others.
  • It supports loadable modules, and has modules to support console/s, moving maps, joysticks, antenna trackers, etc (see: https://github.com/tridge/MAVProxy/tree/master/modules)
  • It's awesome.

Screenshots

Running under Linux:

Running under Windows 7:

Installing MAVProxy

Depending on your operating system, the following packages are required to run MAVProxy:

Linux:

  • python 2.7.X
  • python-matplotlib
  • python-opencv
  • python-serial
  • python-wxgtk

Windows:

MAVProxy also depends on MAVLink (https://github.com/mavlink/mavlink). MAVProxy can be downloaded from https://github.com/tridge/MAVProxy. Both packages can be installed anywhere, as long as they have the same parent folder.

Starting MAVProxy

  • Via serial port:
    mavproxy.py --master=/dev/ttyXXXXX

    (where /dev/ttyXXXXX is a serial device connected to a UAV either directly or via a data radio. On Windows, this will be of the form COM5. Example batch files for Windows are included in MAVProxy)

  • Via network:
    mavproxy.py --master tcp:127.0.0.1:5760

    (where the IP address is either the loopback or local IP address that MAVLink packets are being sent to by a server)

Command line options:

  • --baudrate=115200 The baud rate of the serial port. Default is 115200.
  • --out=127.0.0.1:14550 The IP address and port to forward MAVLink packets to.
  • --aircraft=“Aircraft” The name of the aircraft being logged. MAVProxy logs will be saved to the /Aircraft/logs/Date/FlightNo subfolder. Useful for keeping flight logs organised.
  • --mav09 Use version 0.9 of the MAVLink protocol. Otherwise MAVProxy will use version 1.0
  • --speech Use text-to-speech on important MAVProxy messages (such as flight mode, altitude and velocity).
  • --continue MAVProxy will append to the previous log, rather than creating a new one (it will continue the current flight). Useful if MAVProxy needs to be killed and restarted during flight.

Using MAVProxy

On the console, there are a number of common commands:

Flight Parameters

  • param show X – displays all flight parameters containing X
  • param set X Y – sets flight parameter X to value Y
  • param load param.txt – loads flight parameters from file param.txt
  • param save param.txt – saves flight parameters to file param.txt
  • param fetch – fetches all flight parameters from the UAV and outputs them to console
  • param diff param.txt – shows the delta (differences) between current parameters and param.txt

Waypoints

  • wp list – displays all loaded waypoints
  • wp save way.txt – saves all loaded waypoints to way.txt
  • wp load way.txt – clears current waypoints and loads waypoints from way.txt
  • wp set X – sets the current waypoint to waypoint number X
  • wp clear – delete all waypoints

Geofence

  • fence list – displays all points in the current geofence
  • fence save fence.txt – saves the current geofence to fence.txt
  • fence load fence.txt – clears the current geofence and loads a new geofence from fence.txt
  • fence clear – delete all geofence points

Flight Modes

  • auto – sets AUTO mode
  • loiter – sets LOITER mode
  • rtl – sets RTL mode
  • manual – sets MANUAL mode
  • fbwa – sets FBWA mode

Other

  • calpress – calibrate pressure sensors
  • bat – show battery level
  • alt – show relative altitude
  • rc X Y – override RC channel X with PWM value Y (usually 1000-2000)
  • servo X Y – override servo X with PWM value Y (usually 1000-2000)
  • up – adjust TRIM_PITCH_CD up by 5 degrees. Useful if the UAV is slowly descending during non-manual modes
  • reboot – reboot the autopilot
  • reset – reset the connection to the serial or network port as applicable
  • trim – trim aileron, elevator and rudder to current values
  • link – displays link status (% packet loss, time delay)
  • ground – do a ground start (recalibrate and reinitialise sensors)

MAVProxy Modules

MAVProxy has the ability to load and use any number of modules. They can be loaded with the module load X command and restarted with the module reload X command, where X is the name of the module.

A list of currently running modules can be displayed via module list.

MAVProxy currently includes the following modules:

  • console – a graphical console. It also shows vital flight parameters for easy reference.
  • map – a moving map. Automatic caching of images and SRTM data for offline use. Use the wp list and fence list commands on the console to update the display with waypoints and the geofence.
  • graph – live graph of flight data. Use graph X to start a live plot of data field(s) X. A list of datafields is available at https://pixhawk.ethz.ch/mavlink/
  • antenna – provides pointing information for a directional antenna. Unless set by antenna lat lon, the antenna position defaults to the airfield home position.
  • sensors – checks (and reports) any discrepancy between sensors, such as altitude and heading. Use sensor to list vital flight state parameters.

MAVProxy related links

mavgraph.py

mavgraph.py simple examples:

  • mavgraph.py can graph anything listed in the mavextra.py module , as well as anything python can generate.
  • Graph the mission waypoint number against time (to find out precise timing for a given waypoint):
    mavgraph.py somelogdata.tlog MISSION_CURRENT.seq
  • Graph the distance to the next waypoint:
    mavgraph.py somelogdata.tlog NAV_CONTROLLER_OUTPUT.wp_dist
  • Graph the estimated climb-rate as determined by the AHRS:
    mavgraph.py somelogdata.tlog  VFR_HUD.climb
  • Get altitude above ground - use the altitude() function in mavextra.py, passing it SCALED_PRESSURE:
    mavgraph flight.log 'altitude(SCALED_PRESSURE)'
  • More examples:
    mavgraph.py flight.tlog 'degrees(ATTITUDE.roll)' 'degrees(ATTITUDE.pitch)'
    mavgraph.py flight.tlog 'gravity(RAW_IMU)'
    mavgraph 'mag_field(RAW_IMU)'

mavgraph.py advanced examples:

  • Graph two or more items on different scales into the same window, for easy comparison (the :2 means to put that on the right-side axis as an alternate scale):
    mavgraph.py somelogdata.tlog NAV_CONTROLLER_OUTPUT.wp_dist VFR_HUD.climb:2
  • Graph raw compass heading and DCM calculated heading to compare the two (e.g. to look for DCM/ARHS issues or compass issues):
    mavgraph.py *.tlog VFR_HUD.heading 'mag_heading(RAW_IMU,ATTITUDE,2.1)'
  • Graph calculated compass calibration values over time:
    mavgraph.py mav.log SENSOR_OFFSETS.mag_ofs_x SENSOR_OFFSETS.mag_ofs_y SENSOR_OFFSETS.mag_ofs_z
  • Graph similar to the above, but with pre-configured offsets (e.g. to show what it would have been like if these offsets were used throughout):
    mavgraph.py *.tlog VFR_HUD.heading 'mag_heading(RAW_IMU,ATTITUDE,2.1,SENSOR_OFFSETS,(-25,-20,15))'
  • Graph the computed magnetic field strength with example corrected offsets over the flight:
    mavgraph.py *.tlog 'mag_field(RAW_IMU,SENSOR_OFFSETS,(-45,-1.5,-92.5))'
  • Zooming in on just the interesting section of a log, and applying some low-pass filters to the data to lessen noise a bit (in this case where the throttle is greater than 30%):
    mavgraph.py *.tlog \
      'lowpass(mag_field(RAW_IMU,SENSOR_OFFSETS,(-45,-1.5,-92.5)),"f",0.8)' \
      'lowpass(VFR_HUD.throttle,"t",0.8)':2 \
      --condition='VFR_HUD.throttle>30'
  • Graph separate magnetometer axes with throttle on second axis:
    mavgraph.py *.tlog \
      'lowpass(RAW_IMU.xmag,"x",0.8)' \
      'lowpass(RAW_IMU.ymag,"y",0.8)' \
      'lowpass(RAW_IMU.zmag,"z",0.8)' \
      'lowpass(VFR_HUD.throttle,"t",0.8)':2 \
      --condition='VFR_HUD.throttle>40'
  • [Add your interesting mavgraph.py examples here, with a one line description of what it's trying to achieve!]

Others: mavlogdump, mavmission, flightmodes, mavextract, gpslock and more !

Source: https://github.com/tridge/mavlink/blob/master/pymavlink/examples

  • mavlogdump.py
  • mavmission.py will look through a mission log, and if there is was any upload/download of a mission, it will save the mission out to a QGC compatible mission file (which is also compatible with APM Planner).
  • flightmodes.py will scan a tlog, and give you a log of all the times you changes mode, what the mode/s were, and when.
  • mavextract.py will break your single tlog into a collection of smaller chunks, eg 'auto1.log' for first section of flight that was in 'AUTO' mode, auto2.log for second, and so on. it takes a –mode option, defaulting to 'auto'
  • gpslock.py will scan a log looking for when GPS lock is acquired and lost, and will report it to you.
  • etc…