NOTE: This is currently being migrated to via

Python bindings are available for MAVLink via the pymavlink tool. This tool consists of a generator (called which reads a set of MAVLink XML message definitions and generates a python module for reading and writing those messages


You can get the latest pymavlink code as part of the mavlink source tree via git like this:

git clone git://

The way pymavlink works is that you use the tool to generate a python interface for a given set of MAVLink protocol messages. Typical usage is like this: -o mavlink/message_definitions/common.xml

that will read the common.xml MAVLink message definition and create a python interface. The resulting module will contain:

  • a set of constants for any enums in the XML file
  • a set of constants for the message identifiers
  • a class for each type of MAVLink message defined in the XML file
  • a MAVLink class, which can be used to send and receive messages
  • within the MAVLink class, a _send and _decode function for each message type

The mavlink distribution comes pre-built with a module built from a recent common.xml MAVLink common message definition. If you wish to use messages that are not in common.xml you will need to rebuild your own using a different set of XML files.

API Documentation

The mavgen generator includes the creation of documentation for all of the MAVLink messages, which is available in the usual python way via pydoc.

You can also view a HTML version of the documentation online:


A couple of simple examples are available with the pymavlink package. These examples should help you get started.


A more complete example is provided by MAVProxy, which is a MAVLink protocol proxy. It demonstrates most of the features of using the mavlink module.

You can get MAVProxy via git at the link below, or find out more here:

git clone git://
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported