Skip to content

A multi-process Ground Station for drone control using the MAVLink communication protocol. Features real-time telemetry aggregation, heartbeat monitoring, and automated command logic.

Notifications You must be signed in to change notification settings

mchan5/MAV-GroundControlStation

Repository files navigation

MAVLink Ground Control Station

Python MAVLink Linting

Project Overview

This project implements a multi-process Ground Station capable of autonomously monitoring and controlling a UAV using the MAVLink communication protocol. It is built to interface with PX4, ArduPilot, and other MAVLink-compatible flight stacks. It is designed to simulate real-world airside operations, where independent workers communicate via concurrent queues to handle telemetry aggregation, heartbeat monitoring, and command issuance in real-time with no data loss.

System Architecture

Python, MAVLink Protocol, Multithreading, CI/CD

The core system relies on Python's multiprocessing library to ensure non-blocking operations. The "Main" process acts as the orchestrator, managing the lifecycle of four distinct worker processes:

1. Heartbeat Management

  • Sender: Broadcasts HEARTBEAT (0) messages at 1 Hz to maintain the link with the drone.
  • Receiver: Monitors incoming heartbeats. Implements a watchdog timer that flags the system as "Disconnected" if 5 consecutive heartbeats are missed.

2. Telemetry Aggregation

  • Input: Listens for ATTITUDE (30) and LOCAL_POSITION_NED (32) MAVLink messages.
  • Logic: Synchronizes these asynchronous streams into a single, cohesive TelemetryData object.
  • Output: Pushes the unified state packet to the Command Worker.

3. Command & Control Logic

  • Objective: Keeps the drone focused on a target in 3D space.
  • Yaw Control: Issues MAV_CMD_CONDITION_YAW if the heading deviates by more than .
  • Altitude Control: Issues MAV_CMD_CONDITION_CHANGE_ALT if the altitude deviates by more than 0.5m.
  • Performance: Calculates and logs the drone's average 3D velocity vector between updates.

Testing & Validation

The system includes a suite of integration tests that spawn "Mock Drones" to validate the logic and confirm consistency of each worker.

Running Integration Tests:

# Test Heartbeat Logic
python -m tests.integration.test_heartbeat_sender
python -m tests.integration.test_heartbeat_receiver

# Test Telemetry Aggregation
python -m tests.integration.test_telemetry

# Test Command Logic
python -m tests.integration.test_command

Each of these sections include a script for the logic behind the worker, a script to instantiate and create the worker, and a respective test for each worker. This is integrated into CI/CD testing.

Acknowledgements

The Waterloo Aerial Robotics Group (WARG) helped develop the initial framework for this project. However, all logic and integration was contributed by me.

About

A multi-process Ground Station for drone control using the MAVLink communication protocol. Features real-time telemetry aggregation, heartbeat monitoring, and automated command logic.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages