|
1 | | -# autonomy-bootcamp-2025-p2 |
2 | | -Autonomy bootcamp starting F25 part 2 |
| 1 | +# MAVLink Ground Control Station |
| 2 | + |
| 3 | + |
| 4 | + |
3 | 5 |
|
4 | | -Follow the [instructions](https://uwarg-docs.atlassian.net/wiki/spaces/BOOT/pages/3355672582/NEW+Autonomy+Bootcamp). |
| 6 | +## Project Overview |
5 | 7 |
|
6 | | -You can find part 1 [here](https://github.com/UWARG/autonomy-bootcamp-2025-p1). |
| 8 | +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. |
| 9 | +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. |
| 10 | + |
| 11 | +## System Architecture |
| 12 | +Python, MAVLink Protocol, Multithreading, CI/CD |
| 13 | + |
| 14 | +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: |
| 15 | + |
| 16 | +### 1. Heartbeat Management |
| 17 | +* **Sender:** Broadcasts `HEARTBEAT (0)` messages at **1 Hz** to maintain the link with the drone. |
| 18 | +* **Receiver:** Monitors incoming heartbeats. Implements a watchdog timer that flags the system as **"Disconnected"** if 5 consecutive heartbeats are missed. |
| 19 | + |
| 20 | +### 2. Telemetry Aggregation |
| 21 | +* **Input:** Listens for `ATTITUDE (30)` and `LOCAL_POSITION_NED (32)` MAVLink messages. |
| 22 | +* **Logic:** Synchronizes these asynchronous streams into a single, cohesive `TelemetryData` object. |
| 23 | +* **Output:** Pushes the unified state packet to the Command Worker. |
| 24 | + |
| 25 | +### 3. Command & Control Logic |
| 26 | +* **Objective:** Keeps the drone focused on a target in 3D space. |
| 27 | +* **Yaw Control:** Issues `MAV_CMD_CONDITION_YAW` if the heading deviates by more than **5°**. |
| 28 | +* **Altitude Control:** Issues `MAV_CMD_CONDITION_CHANGE_ALT` if the altitude deviates by more than **0.5m**. |
| 29 | +* **Performance:** Calculates and logs the drone's average 3D velocity vector between updates. |
| 30 | + |
| 31 | +## Testing & Validation |
| 32 | + |
| 33 | +The system includes a suite of integration tests that spawn "Mock Drones" to validate the logic and confirm consistency of each worker. |
| 34 | + |
| 35 | +**Running Integration Tests:** |
| 36 | +```bash |
| 37 | +# Test Heartbeat Logic |
| 38 | +python -m tests.integration.test_heartbeat_sender |
| 39 | +python -m tests.integration.test_heartbeat_receiver |
| 40 | + |
| 41 | +# Test Telemetry Aggregation |
| 42 | +python -m tests.integration.test_telemetry |
| 43 | + |
| 44 | +# Test Command Logic |
| 45 | +python -m tests.integration.test_command |
| 46 | + |
| 47 | +``` |
| 48 | +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. |
| 49 | + |
| 50 | +## Acknowledgements |
| 51 | +The Waterloo Aerial Robotics Group (WARG) helped develop the initial framework for this project. However, all logic and integration was contributed by me. |
0 commit comments