Python MAVLink code
Actively maintained. Last release 2 months ago, commits in 17 of the last 26 weeks. A safe choice.
pip install pymavlinkPymavlink
This is a Python implementation of the MAVLink protocol. It includes a source code generator (generator/mavgen.py) to create MAVLink protocol implementations for other programming languages as well. Also contains tools for analyzing flight logs.
Documentation
Please see http://ardupilot.org/dev/docs/mavlink-commands.html for mavlink command reference.
For realtime discussion please see the pymavlink Gitter channel
Examples can be found in the repository or in the ArduSub book
Installation
Pymavlink supports Python 3. Python 2 support has been removed.
The following instructions assume you are using a Debian-based (like Ubuntu) installation.
Dependencies
Pymavlink has several dependencies :
- [lxml](http://lxml.de/installation.html) : for checking and parsing xml file
Optional :
- numpy : for FFT
- pytest : for tests
On Linux
lxml has some additional dependencies that can be installed with your package manager (here with apt):
sudo apt install libxml2-dev libxslt-dev
Optional for FFT scripts and tests:
sudo apt install python3-numpy python3-pytest
Analogously you can install the required dependencies for pymavlink:
sudo apt install python3-lxml
Alternatively, in the unlikely event that your distribution (other than Debian and its derivatives like Ubuntu) does not feature that package, you may decide to use pip and install the missing dependency from its source tree:
sudo apt install python3-pip
sudo python3 -m pip install --upgrade lxml
Yet another alternative is to use brew, in perfect analogy to how it is described for the macOS.
On macOS
lxml's native dependencies (libxml2 and libxslt) can be installed with :