Python Libraries (mavgen)

This topic explains how to get and use the MAVLink Python libraries (generated using mavgen).

This information has been ported from the legacy site, but not yet updated/reviewed.

Getting Libraries

The Python MAVLink libraries are not pre-built, so you will need to install mavgen and generate them yourself.

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


A number of simple examples are available in the pymavlink submodule. These examples should help you get started.


A more complete example is provided by MAVProxy, which is a command-line, console based UAV ground station software package for MAVLink based systems. It demonstrates most of the features of using the MAVLink module.

You can get MAVProxy source using the official developer documentation.

results matching ""

    No results matching ""