MAVProxy
MAVProxy (MAVLink Proxy) is a powerful, flexible, and extensible command-line ground station for MAVLink-enabled vehicles, primarily used with ArduPilot and PX4 autopilots. It acts as a telemetry relay, data logger, and provides an interactive interface for controlling and monitoring drones. The library is actively maintained by the ArduPilot community, with frequent patch releases addressing bug fixes and new features. The current version is 1.8.74.
Common errors
-
OSError: [Errno 13] Permission denied: '/dev/ttyUSB0'
cause The current user does not have read/write permissions for the specified serial device.fixAdd your user to the 'dialout' group (Linux): `sudo usermod -a -G dialout $USER`. Log out and back in. For Windows, ensure the COM port is not in use by another application. -
ModuleNotFoundError: No module named 'MAVProxy'
cause You are trying to import 'MAVProxy' as a top-level package, but its main components are within a capitalized sub-package, or you are trying to run `mavproxy.py` without it being in your PATH.fixFor command-line use, ensure `mavproxy.py` is in your system's PATH. If programmatically importing, use `from MAVProxy.MAVProxy import MAVProxy` or `from MAVProxy.modules.lib import mp_module`. -
TypeError: 'module' object is not callable
cause You might be trying to call `mavproxy` as a function or object directly after `import mavproxy`, which is incorrect.fixMAVProxy is primarily used via its `mavproxy.py` command-line script. If you intend to use its functionalities programmatically, import specific classes or functions from `MAVProxy` sub-packages, for example: `from MAVProxy.MAVProxy import MAVProxy` to instantiate the core GCS.
Warnings
- breaking MAVProxy officially dropped support for Python 2.x starting from version 1.8.10. Attempting to run it with Python 2 will result in syntax errors or import failures.
- gotcha Many MAVProxy modules (e.g., map, grapher) have additional dependencies not included in the base installation. If you encounter errors related to missing modules like 'matplotlib', 'Pillow', or 'lxml' when using these features, you need to install them separately.
- gotcha On Linux, connecting to serial devices (like '/dev/ttyUSB0') often requires appropriate user permissions. Without them, MAVProxy will fail with a 'Permission denied' error.
- gotcha There can be tight coupling between MAVProxy, pymavlink, and MAVLink library versions. Updating one without the others can sometimes lead to MAVLink parsing errors or unexpected behavior due to protocol definition mismatches.
Install
-
pip install mavproxy
Imports
- MAVProxy
import mavproxy
from MAVProxy.MAVProxy import MAVProxy
- mp_module
from MAVProxy.modules.lib import mp_module
Quickstart
mavproxy.py --master=/dev/ttyUSB0 --baudrate 57600 --aircraft MyDrone # Or, for SITL (Software In The Loop) simulation: mavproxy.py --master=tcp:127.0.0.1:5760 --out=udp:127.0.0.1:14550 --aircraft MySimDrone