Project • Open-Source Library • UAARG • Mar 8, 2025

mavctl-python – PyMAVLink-Based Autonomous Drone Control

mavctl-python is an open-source Python library from the University of Alberta Aerial Robotics Group (UAARG) that integrates MAVLink via PyMAVLink for autonomous drone navigation. It provides a clean, structured API for commanding and maneuvering MAVLink-compatible vehicles (e.g. drones running ArduPilot or PX4) from Python, and is designed as a modern revamp and eventual replacement for DroneKit in UAARG’s software stack.

Context

UAARG • Open-source library

Tech

Python, PyMAVLink, MAVLink

Focus

Autonomous navigation API for drones

1. What the Repo Does

mavctl-python sits between your Python application and the drone’s flight stack. You establish a MAVLink connection (e.g. over serial or UDP), get a PyMAVLink object, and pass it into mavctl’s Navigator class. The Navigator exposes methods for high-level navigation actions—for example, “move the drone 1 m North” or “go to this position”—so that mission logic can stay at the behavior level instead of raw MAVLink messages.

The library is intentionally structured so that basic moves live in the Navigator, while more complex maneuvers are implemented in separate modules. Those advanced maneuvers are not separate classes; they are functions or callables that take a Navigator instance as an argument. That keeps the core simple and makes it easy to add new behaviors without bloating the Navigator API.

2. Architecture & Conventions

The intended flow is:

  • Create a MAVLink connection and obtain a PyMAVLink object.
  • Instantiate the Navigator with that object.
  • Use Navigator methods for standard navigation (e.g. position hold, simple moves).
  • For advanced maneuvers, pass the Navigator into dedicated functions in other files (e.g. advanced.py).

Contributors are asked to follow this structure so that the codebase stays consistent and navigator logic remains in one place while mission-specific or experimental behaviors live in their own modules.

3. Relation to DroneKit & Shepard

The project draws inspiration from DroneKit, reimplementing and improving on the patterns that work well there, with the long-term goal of exceeding DroneKit’s functionality for UAARG’s use cases. Familiarity with MAVLink is recommended; the repo also points to Shepard (UAARG’s autopilot software) for reference on how navigation functions and flight-test scripts are organized, so that mavctl-python and Shepard can work together in the same ecosystem.

4. Summary

mavctl-python is a focused, open-source library for autonomous drone control via MAVLink. It provides a Navigator-centric API for basic and advanced maneuvers, encourages a clear separation between core navigation and mission-specific logic, and fits into UAARG’s broader toolchain alongside Shepard and MAVLink-based flight stacks.

For code, issues, and pull requests, see the mavctl-python repository.