pyMAVLinCS 1.0.2__tar.gz → 1.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pymavlincs-1.0.3/PKG-INFO +398 -0
- pymavlincs-1.0.3/README.md +384 -0
- {pymavlincs-1.0.2 → pymavlincs-1.0.3}/pyMAVLinCS/__init__.py +3 -2
- pymavlincs-1.0.3/pyMAVLinCS.egg-info/PKG-INFO +398 -0
- {pymavlincs-1.0.2 → pymavlincs-1.0.3}/pyproject.toml +1 -1
- pymavlincs-1.0.2/PKG-INFO +0 -65
- pymavlincs-1.0.2/README.md +0 -51
- pymavlincs-1.0.2/pyMAVLinCS.egg-info/PKG-INFO +0 -65
- {pymavlincs-1.0.2 → pymavlincs-1.0.3}/LICENSE +0 -0
- {pymavlincs-1.0.2 → pymavlincs-1.0.3}/pyMAVLinCS/mavecstra.py +0 -0
- {pymavlincs-1.0.2 → pymavlincs-1.0.3}/pyMAVLinCS/mavtypes.py +0 -0
- {pymavlincs-1.0.2 → pymavlincs-1.0.3}/pyMAVLinCS/mission_control_code.py +0 -0
- {pymavlincs-1.0.2 → pymavlincs-1.0.3}/pyMAVLinCS/setup_logger.py +0 -0
- {pymavlincs-1.0.2 → pymavlincs-1.0.3}/pyMAVLinCS.egg-info/SOURCES.txt +0 -0
- {pymavlincs-1.0.2 → pymavlincs-1.0.3}/pyMAVLinCS.egg-info/dependency_links.txt +0 -0
- {pymavlincs-1.0.2 → pymavlincs-1.0.3}/pyMAVLinCS.egg-info/requires.txt +0 -0
- {pymavlincs-1.0.2 → pymavlincs-1.0.3}/pyMAVLinCS.egg-info/top_level.txt +0 -0
- {pymavlincs-1.0.2 → pymavlincs-1.0.3}/setup.cfg +0 -0
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyMAVLinCS
|
|
3
|
+
Version: 1.0.3
|
|
4
|
+
Summary: Python API for autonomous drone control based on pymavlink
|
|
5
|
+
Author-email: Noah Redon <redonnoah.cs@gmail.com>
|
|
6
|
+
License: GPL-3.0-or-later
|
|
7
|
+
Requires-Python: >=3.8
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: pymavlink>=2.4.49
|
|
11
|
+
Requires-Dist: pyserial
|
|
12
|
+
Requires-Dist: geopy
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
<h1 align="center"> pyMAVLinCS </h1>
|
|
16
|
+
<p align="center"> The high-level Python API for reliable, autonomous drone control, advanced telemetry, and MAVLink mission management. </p>
|
|
17
|
+
|
|
18
|
+
<p align="center">
|
|
19
|
+
<img alt="License_new" src="https://img.shields.io/badge/License-GPL%20v3-yellow">
|
|
20
|
+
<img alt="GitHub" src="https://img.shields.io/badge/github-noahredon-blue?logo=github">
|
|
21
|
+
<img alt="Python" src="https://img.shields.io/badge/Python-grey?logo=python">
|
|
22
|
+
</p>
|
|
23
|
+
<!--
|
|
24
|
+
https://shields.io
|
|
25
|
+
-->
|
|
26
|
+
|
|
27
|
+
***
|
|
28
|
+
|
|
29
|
+
## 📖 Table of Contents
|
|
30
|
+
* [✨ Overview](#-overview)
|
|
31
|
+
* [🚀 Key Features](#-key-features)
|
|
32
|
+
* [🛠️ Tech Stack & Architecture](#-tech-stack--architecture)
|
|
33
|
+
* [📁 Project Structure](#-project-structure)
|
|
34
|
+
* [📸 Demo & Screenshots](#-demo--screenshots)
|
|
35
|
+
* [⚙️ Getting Started](#-getting-started)
|
|
36
|
+
* [🎯 Usage](#-usage)
|
|
37
|
+
* [🤝 Contributing](#-contributing)
|
|
38
|
+
* [📝 License](#-license)
|
|
39
|
+
|
|
40
|
+
***
|
|
41
|
+
|
|
42
|
+
## ✨ Overview
|
|
43
|
+
|
|
44
|
+
pyMAVLinCS is a powerful, professional-grade Python library designed to simplify the development of autonomous systems by providing a high-level, stable, and feature-rich interface for MAVLink-based flight controllers (like ArduPilot and PX4).
|
|
45
|
+
|
|
46
|
+
> ⚠️ **The Problem:** Developing complex drone missions or ground control stations (GCS) often requires deep, low-level integration with the MAVLink protocol. This involves handling command acknowledgments, managing asynchronous message streams (like `STATUSTEXT` or `TIMESYNC`), performing complex geographic calculations, and ensuring thread safety, leading to verbose and error-prone code.
|
|
47
|
+
|
|
48
|
+
pyMAVLinCS eliminates this complexity by wrapping the core `pymavlink` functionality into an intuitive, object-oriented API (`MAVLinCS` class). It enables developers and engineers to execute mission-critical commands, retrieve comprehensive telemetry, manage gimbal payloads, and handle inter-system communication using simple, Pythonic method calls. This allows users to focus entirely on mission logic and operational safety, drastically reducing development time and enhancing code reliability.
|
|
49
|
+
|
|
50
|
+
The library is built around core Python features, geographic computations (`geopy`), and MAVLink messages handler (`pymavlink`). Internal handler classes ensure seamless management of complex MAVLink processes like statustext reconstruction, timesync calculation, and structured logging.
|
|
51
|
+
|
|
52
|
+
***
|
|
53
|
+
|
|
54
|
+
## 🚀 Key Features
|
|
55
|
+
|
|
56
|
+
pyMAVLinCS provides comprehensive capabilities spanning control, data retrieval, mission management, and advanced system configuration. These features are implemented through a rich set of methods in the core `MAVLinCS` class.
|
|
57
|
+
|
|
58
|
+
### 📡 Real-Time Telemetry and System Status
|
|
59
|
+
|
|
60
|
+
Gain instant access to crucial flight and system data using simple method calls that handle message retrieval and parsing automatically:
|
|
61
|
+
* 🛰️ **Global Position (`position_gps`):** Retrieve current GPS coordinates (latitude, longitude, altitude) and local coordinates (`position_local`).
|
|
62
|
+
* 🧭 **Attitude and Velocity:** Get precise attitude angles (`angles`) and angular rates (`angular_rates`). Retrieve linear velocities in three dimensions (`speed`) and absolute module speed (`speed_module`).
|
|
63
|
+
* ⚡ **Power Monitoring:** Check remaining battery percentage (`battery_percentage`) and current voltage (`battery_voltage`) (requires flight controller configuration).
|
|
64
|
+
* ⚙️ **Flight Status:** Instantly check arming status (`motors_armed`, `motors_disarmed`), current flight mode (`mode`, `custom_mode`), and base mode details (`base_mode`, `custom_main_mode`, `custom_sub_mode` for PX4 systems).
|
|
65
|
+
* 🌐 **Fix Status:** Confirm the status of the GPS system, including 3D fix availability (`gps_3d_fix`).
|
|
66
|
+
* 🕒 **Timing Data:** Access system boot time in seconds (`time_boot`) and milliseconds (`time_boot_ms`), and Unix timestamp in microseconds (`time_usec`).
|
|
67
|
+
|
|
68
|
+
### 🕹️ Autonomous Control and Action Execution
|
|
69
|
+
|
|
70
|
+
Execute mission-critical commands with built-in acknowledgment handling to ensure reliable action completion:
|
|
71
|
+
* 🔑 **System State Management:** Safely arm (`arm`) or disarm (`disarm`) the drone, with options for forced execution and command timeout.
|
|
72
|
+
* 🚁 **Movement Commands:** Initiate automated takeoff (`takeoff`) to a specified altitude or perform a simple landing (`land`, currently implemented for ArduPilot).
|
|
73
|
+
* 🔄 **Flight Mode Control:** Change the flight behavior using high-level names, integers, or tuples to specify mode (`set_mode`).
|
|
74
|
+
* 🗺️ **Targeted Movement:** Set precise GPS position targets (`set_gps_pos_target`) or local position targets (`set_local_pos_target`) for navigation.
|
|
75
|
+
* 💨 **Velocity Control:** Directly command the drone's velocity components (`set_speed`) (North, East, Down in m/s).
|
|
76
|
+
* 🏠 **Return to Launch (RTL):** Send a Return-To-Launch request (`return_to_launch`) for safe mission abort.
|
|
77
|
+
|
|
78
|
+
### 📐 Advanced Position and Geographic Utility
|
|
79
|
+
|
|
80
|
+
Utilize powerful built-in mathematical functions for complex navigation and coordinate system management:
|
|
81
|
+
* 📍 **Home Position Management:** Request and retrieve the designated HOME position (`request_home_position`, `home_position`) and set a new HOME location (`set_home`, `set_home_current_pos`).
|
|
82
|
+
* 🌍 **EKF Origin:** Get or set the EKF origin location (`ekf_origin`, `set_ekf_origin`) for accurate local navigation initialization.
|
|
83
|
+
* 📏 **Distance Calculation:** Calculate the distance between the flight controller and a specified GPS point (`get_distance_with_gps_pos`) or a local coordinate point (`get_distance_with_local_pos`).
|
|
84
|
+
* 🔄 **Coordinate Conversion Utilities:** Perform complex geometric transformations, including conversion from Quaternion to Euler angles (`quaternion_to_euler`), distance between two GPS points (`distance_between_two_gps_points`), and converting Cartesian or polar displacements relative to the drone's position into geographic points (`cartesian_to_geographic_point`, `polar_to_geographic_point`).
|
|
85
|
+
|
|
86
|
+
### ⚙️ Mission Planning and Waypoint Management
|
|
87
|
+
|
|
88
|
+
Simplify the workflow for designing and executing automated missions:
|
|
89
|
+
* 🔢 **Waypoint Management:** Send individual waypoints (`send_waypoint`), inform the flight controller of the total number of waypoints being sent (`send_waypoint_count`), or delete all stored waypoints (`clear_waypoints`).
|
|
90
|
+
* ▶️ **Mission Execution:** Start the loaded mission from a specified waypoint (`start_mission`, currently implemented for ArduPilot).
|
|
91
|
+
* ✅ **Mission Status:** Check the sequence number of the current waypoint (`current_waypoint_seq`) and verify if the mission is completed (`is_waypoint_mission_completed`).
|
|
92
|
+
|
|
93
|
+
### 📸 Gimbal and Payload Control
|
|
94
|
+
|
|
95
|
+
Integrated support for controlling camera gimbals and other peripherals:
|
|
96
|
+
* 🖼️ **Angle Setting:** Orient the gimbal precisely by setting pitch and yaw angles (`set_gimbal_angles`).
|
|
97
|
+
* 📌 **Position Targeting:** Send a target GPS position for the gimbal to track (`set_gimbal_target`).
|
|
98
|
+
* 🔌 **Mode Setting:** Set the gimbal to retract position (no stabilization, `set_gimbal_retract`) or neutral position (roll=pitch=yaw=0, `set_gimbal_neutral`).
|
|
99
|
+
* 📏 **Servo Control:** Directly set the PWM value for any specific servo channel (`set_servo`).
|
|
100
|
+
|
|
101
|
+
### 🔔 Asynchronous Communication & Messaging
|
|
102
|
+
|
|
103
|
+
Dedicated handler classes simplify listening for and sending custom messages:
|
|
104
|
+
* 💬 **Status Text Handling:** Receive and reconstruct segmented `STATUSTEXT` messages (`last_statustext_from_sysidcompid`).
|
|
105
|
+
* 🕰️ **Latency Monitoring:** Send `TIMESYNC` broadcasts (`send_timesync`) and retrieve the estimated one-way latency (`get_latence_ms_with_sysidcompid`) to various components.
|
|
106
|
+
* 📢 **Custom Messaging:** Send status messages (`send_statustext`), named integer values (`send_named_value_int`), or proprietary Mission Control Code (MCC) messages (`send_mcc`, `check_mcc`, `delete_mcc`).
|
|
107
|
+
|
|
108
|
+
### ⏳ Synchronized Wait Operations
|
|
109
|
+
|
|
110
|
+
Implement robust, blocking operations that pause execution until a required condition is met:
|
|
111
|
+
* 🔒 **Arming Synchronization:** Wait until motors are confirmed armed or disarmed (`wait_motors_armed`, `wait_motors_disarmed`).
|
|
112
|
+
* ✈️ **Mode Synchronization:** Wait for the flight mode to successfully change (`wait_mode_changed`).
|
|
113
|
+
* 📍 **Position Synchronization:** Wait until a GPS 3D fix is obtained (`wait_gps_3d_fix`) or until the drone reaches proximity to a target GPS or local position (`wait_proximity_with_gps_pos`, `wait_proximity_with_local_pos`).
|
|
114
|
+
* 📝 **Command Acknowledgment:** Block execution until a specific `COMMAND_ACK` or `MISSION_ACK` is received and validated (`wait_command_ack`, `wait_mission_ack`).
|
|
115
|
+
|
|
116
|
+
***
|
|
117
|
+
|
|
118
|
+
## 🛠️ Tech Stack & Architecture
|
|
119
|
+
|
|
120
|
+
pyMAVLinCS is designed as a focused Python library, utilizing highly optimized core components for reliable aerospace communication and data processing.
|
|
121
|
+
|
|
122
|
+
| Technology | Purpose | Why it was Chosen |
|
|
123
|
+
| :--- | :--- | :--- |
|
|
124
|
+
| **Python** | Primary development language for the API. | Provides a clean, readable syntax ideal for complex robotics and scientific computation. |
|
|
125
|
+
| **pymavlink** | Core dependency for MAVLink protocol communication. | Essential library for parsing, generating, and transmitting MAVLink messages to flight controllers. |
|
|
126
|
+
| **geopy** | Dependency for geographic calculations. | Provides accurate tools for distance, azimuth, and coordinate transformation necessary for mission planning. |
|
|
127
|
+
| **setuptools** | Build system component. | Standard tool used for packaging and distributing Python projects, defining the required metadata. |
|
|
128
|
+
| **wheel** | Build system component. | Enables the creation of standardized binary distribution packages for faster installation. |
|
|
129
|
+
|
|
130
|
+
***
|
|
131
|
+
|
|
132
|
+
## 📁 Project Structure
|
|
133
|
+
|
|
134
|
+
The project structure is organized to separate the core MAVLink interface, supporting utility classes, examples, and CI/CD configurations.
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
📂 pyMAVLinCS/
|
|
138
|
+
├── 📂 pyMAVLinCS/ # Core Library Package
|
|
139
|
+
│ ├── 📄 __init__.py # Main entry point (MAVLinCS class definition, all control methods)
|
|
140
|
+
│ ├── 📄 mission_control_code.py # Class definition for MCC (Mission Control Code) messages
|
|
141
|
+
│ ├── 📄 mavtypes.py # Data models (GPSPosition, Angles, Speed, HomePosition, etc.)
|
|
142
|
+
│ ├── 📄 setup_logger.py # Logging setup utility and custom formatters
|
|
143
|
+
│ └── 📄 mavecstra.py # Core MAVLink communication extensions (TimesyncHandler, StatustextReceiver)
|
|
144
|
+
├── 📂 examples/ # Demonstrative usage scripts
|
|
145
|
+
│ ├── 📄 arm_drone.py # Example script for arming procedure
|
|
146
|
+
│ ├── 📄 mcc_creation.py # Example script showing MCC object usage
|
|
147
|
+
│ ├── 📄 __init__.py # Initialization file for examples package
|
|
148
|
+
│ └── 📄 connection_test.py # Script to test basic flight controller connectivity
|
|
149
|
+
├── 📂 tests/ # Placeholder directory for test files
|
|
150
|
+
│ └── 📄 __init__.py # Initialization file for tests package
|
|
151
|
+
├── 📂 .github/ # GitHub configuration
|
|
152
|
+
│ └── 📂 workflows/ # Continuous Integration workflows
|
|
153
|
+
│ └── 📄 publish.yml # Workflow for package publication (e.g., PyPI)
|
|
154
|
+
├── 📄 pyproject.toml # Project metadata, dependencies, and build requirements
|
|
155
|
+
├── 📄 LICENSE # Project License (GPL-3.0-or-later)
|
|
156
|
+
├── 📄 README.md # Project documentation (this file)
|
|
157
|
+
└── 📄 .gitignore # Git ignore rules
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
***
|
|
161
|
+
|
|
162
|
+
## ⚙️ Getting Started
|
|
163
|
+
|
|
164
|
+
To utilize pyMAVLinCS, you need Python and the necessary dependencies. This library is distributed via standard Python package mechanisms.
|
|
165
|
+
|
|
166
|
+
### Prerequisites
|
|
167
|
+
|
|
168
|
+
Ensure you have the following installed:
|
|
169
|
+
|
|
170
|
+
* **Python:** Version 3.8 or higher (`>=3.8` is required).
|
|
171
|
+
* **A MAVLink-compatible flight controller** (e.g., ArduPilot, PX4).
|
|
172
|
+
* **A stable communication link** (e.g., USB, Serial, UDP).
|
|
173
|
+
|
|
174
|
+
### Installation
|
|
175
|
+
|
|
176
|
+
Since pyMAVLinCS is packaged using `setuptools` and defined in `pyproject.toml`, standard installation methods will pull all required dependencies (`pymavlink`, `pyserial`, `geopy`).
|
|
177
|
+
|
|
178
|
+
1. **Install the library using pip:**
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
pip install pyMAVLinCS
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
2. **Verify installation:**
|
|
185
|
+
You should now be able to import the core class in your Python environment:
|
|
186
|
+
|
|
187
|
+
```python
|
|
188
|
+
from pyMAVLinCS import MAVLinCS
|
|
189
|
+
|
|
190
|
+
# Ready to initialize a connection
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
***
|
|
194
|
+
|
|
195
|
+
## 🎯 Usage
|
|
196
|
+
|
|
197
|
+
pyMAVLinCS is used by instantiating the core `MAVLinCS` class with the desired connection address (it opens the connection). The library handles opening and closing the MAVLink connection and managing all internal communication threads.
|
|
198
|
+
|
|
199
|
+
### 1. Establishing a Connection
|
|
200
|
+
|
|
201
|
+
The `MAVLinCS` class constructor requires an address string that specifies the connection method (e.g., TCP, UDP, serial).
|
|
202
|
+
|
|
203
|
+
```python
|
|
204
|
+
from pyMAVLinCS import MAVLinCS
|
|
205
|
+
|
|
206
|
+
# Example 1: Connect via UDP to a GCS port (common simulation setup)
|
|
207
|
+
udp_address = 'udp:127.0.0.1:14550'
|
|
208
|
+
drone = MAVLinCS(address=udp_address)
|
|
209
|
+
|
|
210
|
+
# Example 2: Connect via Serial (replace /dev/ttyACM0 with your serial port)
|
|
211
|
+
# serial_address = '/dev/ttyACM0'
|
|
212
|
+
# baudrate = 921600
|
|
213
|
+
# drone = MAVLinCS(address=serial_address, baud=baudrate)
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### 2. Performing Autonomous Actions (Control)
|
|
217
|
+
|
|
218
|
+
Execute complex command and control actions with built-in acknowledgment waits:
|
|
219
|
+
|
|
220
|
+
```python
|
|
221
|
+
try:
|
|
222
|
+
# Wait for the drone to achieve a 3D GPS fix before proceeding
|
|
223
|
+
print("Waiting for 3D GPS Fix...") # You can also use the logger directly from the MAVLinCS object
|
|
224
|
+
# drone.logger.info("Waiting for 3D GPS Fix...")
|
|
225
|
+
drone.wait_gps_3d_fix()
|
|
226
|
+
print("GPS Fix Acquired.")
|
|
227
|
+
|
|
228
|
+
# Arm the drone (waits for confirmation)
|
|
229
|
+
armed = drone.arm()
|
|
230
|
+
if not armed:
|
|
231
|
+
raise RuntimeError("Drone not armed.")
|
|
232
|
+
print("Drone armed successfully.")
|
|
233
|
+
|
|
234
|
+
# Change the flight mode to 'GUIDED' (example for ArduPilot)
|
|
235
|
+
mode_changed = drone.set_mode('GUIDED')
|
|
236
|
+
if not mode_changed:
|
|
237
|
+
raise RuntimeError("Drone not in GUIDED mode.")
|
|
238
|
+
print(f"Current Mode: {drone.mode()}")
|
|
239
|
+
|
|
240
|
+
# Execute a takeoff to 10 meters (requires prior arming)
|
|
241
|
+
takeoff_successful = drone.takeoff(altitude=10)
|
|
242
|
+
if not takeoff_successful:
|
|
243
|
+
raise RuntimeError("Drone takeoff failed.")
|
|
244
|
+
print("Takeoff successful.")
|
|
245
|
+
except (Exception, KeyboardInterrupt) as e:
|
|
246
|
+
drone.close()
|
|
247
|
+
print("Connection closed.")
|
|
248
|
+
raise e
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### 3. Retrieving Real-Time Telemetry
|
|
252
|
+
|
|
253
|
+
Access structured data models defining the drone's state:
|
|
254
|
+
|
|
255
|
+
```python
|
|
256
|
+
try:
|
|
257
|
+
# Get current GPS position and local position
|
|
258
|
+
gps_pos = drone.position_gps()
|
|
259
|
+
local_pos = drone.position_local()
|
|
260
|
+
|
|
261
|
+
print(f"\n--- Telemetry Snapshot ---")
|
|
262
|
+
print(f"Latitude: {gps_pos.lat:.6f}°, Longitude: {gps_pos.lon:.6f}°, Altitude (GPS): {gps_pos.alt:.2f}m")
|
|
263
|
+
print(f"North (Local): {local_pos.x:.2f}m, East (Local): {local_pos.y:.2f}m")
|
|
264
|
+
|
|
265
|
+
# Get attitude angles (roll, pitch, yaw)
|
|
266
|
+
angles = drone.angles()
|
|
267
|
+
print(f"Roll: {angles.roll:.1f}rad, Pitch: {angles.pitch:.1f}rad, Yaw: {angles.yaw:.1f}rad")
|
|
268
|
+
|
|
269
|
+
# Check battery status
|
|
270
|
+
voltage = drone.battery_voltage()
|
|
271
|
+
percentage = drone.battery_percentage()
|
|
272
|
+
print(f"Battery: {percentage}% ({voltage}V)")
|
|
273
|
+
except (Exception, KeyboardInterrupt) as e:
|
|
274
|
+
drone.close()
|
|
275
|
+
print("Connection closed.")
|
|
276
|
+
raise e
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### 4. Mission Management
|
|
280
|
+
|
|
281
|
+
pyMAVLinCS also allows the sending of Mission Control Codes, enabling simple communication between two ground stations.
|
|
282
|
+
|
|
283
|
+
You can create a Python file (e.g. `mcc_creation.py`) where you define some Mission Control Codes:
|
|
284
|
+
|
|
285
|
+
```python
|
|
286
|
+
from pyMAVLinCS.mission_control_code import MCC
|
|
287
|
+
|
|
288
|
+
DRONE_STARTED = MCC(
|
|
289
|
+
value=1,
|
|
290
|
+
name="DRONE_STARTED",
|
|
291
|
+
level="SUCCESS",
|
|
292
|
+
description="Drone started."
|
|
293
|
+
)
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
and in your main file, you can specify it with the `mcc_class` argument while creating a MAVLinCS instance, or you can use it like this:
|
|
297
|
+
|
|
298
|
+
```python
|
|
299
|
+
import mcc_creation as mcc_mod
|
|
300
|
+
|
|
301
|
+
drone.mcc_class = mcc_mod.MCC
|
|
302
|
+
drone.send_mcc(mcc_mod.DRONE_STARTED)
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
For the other ground station, you also need to specify the right MCC Class in your Python script. In this case, MCCs will be stored in a set and logged in a concise way: `[level][name] description`.
|
|
306
|
+
|
|
307
|
+
You can also add a callback when receiving a MCC with `set_mcc_callback`, check anytime if a MCC is stored with `check_mcc` or delete the stored MCC with `delete_mcc`.
|
|
308
|
+
|
|
309
|
+
### 5. Closing the Connection
|
|
310
|
+
|
|
311
|
+
Always ensure the connection is safely closed to stop the background communication thread and the connection closure (e.g. if using a serial link):
|
|
312
|
+
|
|
313
|
+
```python
|
|
314
|
+
# Close the connection when done
|
|
315
|
+
drone.close()
|
|
316
|
+
print("Connection closed.")
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
***
|
|
320
|
+
|
|
321
|
+
## 🤝 Contributing
|
|
322
|
+
|
|
323
|
+
We welcome contributions to improve pyMAVLinCS! Your input helps make this project a more robust and reliable tool for autonomous vehicle development.
|
|
324
|
+
|
|
325
|
+
### How to Contribute
|
|
326
|
+
|
|
327
|
+
1. **Fork the repository** - Click the 'Fork' button at the top right of this page.
|
|
328
|
+
2. **Create a feature branch**
|
|
329
|
+
```bash
|
|
330
|
+
git checkout -b feature/new-telemetry-endpoint
|
|
331
|
+
```
|
|
332
|
+
3. **Make your changes** - Improve code, documentation, or features within the `pyMAVLinCS/` directory.
|
|
333
|
+
4. **Test thoroughly** - Ensure all existing and new functionality works as expected. While no external testing suite (like pytest) is available right now, manual verification of functionality is crucial.
|
|
334
|
+
```bash
|
|
335
|
+
# Execute existing test files or examples:
|
|
336
|
+
python examples/connection_test.py
|
|
337
|
+
```
|
|
338
|
+
5. **Commit your changes** - Write clear, descriptive commit messages.
|
|
339
|
+
```bash
|
|
340
|
+
git commit -m 'Fix: Corrected latency calculation bug in TimesyncHandler'
|
|
341
|
+
```
|
|
342
|
+
6. **Push to your branch**
|
|
343
|
+
```bash
|
|
344
|
+
git push origin feature/new-telemetry-endpoint
|
|
345
|
+
```
|
|
346
|
+
7. **Open a Pull Request** - Submit your changes for review by the maintainers.
|
|
347
|
+
|
|
348
|
+
### Development Guidelines
|
|
349
|
+
|
|
350
|
+
* ✅ Follow the existing Python code style and conventions.
|
|
351
|
+
* 📝 Add comprehensive docstrings and comments for complex logic, especially within `MAVLinCS` and `mavecstra.py`.
|
|
352
|
+
* 🧪 Whenever possible, ensure changes are verified against a MAVLink simulator or hardware.
|
|
353
|
+
* 📚 Update documentation, including the `README.md`, for any changed functionality or new public methods.
|
|
354
|
+
* 🔄 Ensure backward compatibility when modifying existing API calls.
|
|
355
|
+
* 🎯 Keep commits focused and atomic, addressing a single feature or bug fix per commit.
|
|
356
|
+
|
|
357
|
+
### Ideas for Contributions
|
|
358
|
+
|
|
359
|
+
We're looking for help with:
|
|
360
|
+
|
|
361
|
+
* 🐛 **Bug Fixes:** Address issues related to connection stability or command ACK timeouts.
|
|
362
|
+
* ✨ **New Features:** Implement support for newly released MAVLink messages or system types.
|
|
363
|
+
* 📖 **Documentation:** Improve tutorials, usage examples in the `examples/` directory, and method descriptions.
|
|
364
|
+
* ⚡ **Performance:** Optimize message parsing and handler loop efficiency in `mavecstra.py`.
|
|
365
|
+
* 🧪 **Testing:** Expand the test suite coverage in the `tests/` directory.
|
|
366
|
+
|
|
367
|
+
### Code Review Process
|
|
368
|
+
|
|
369
|
+
* All submissions require review before merging.
|
|
370
|
+
* Maintainers will provide constructive feedback on clarity, efficiency, and adherence to MAVLink best practices.
|
|
371
|
+
* Changes may be requested before approval.
|
|
372
|
+
* Once approved, your PR will be merged, and you'll be credited for your contribution.
|
|
373
|
+
|
|
374
|
+
### Questions?
|
|
375
|
+
|
|
376
|
+
Feel free to open an issue for any questions or concerns regarding development, usage, or MAVLink specifics. We're here to help!
|
|
377
|
+
|
|
378
|
+
***
|
|
379
|
+
|
|
380
|
+
## 📝 License
|
|
381
|
+
|
|
382
|
+
This project is licensed under the **GPL-3.0-or-later** license - see the [LICENSE](LICENSE) file for complete details.
|
|
383
|
+
|
|
384
|
+
### What this means:
|
|
385
|
+
|
|
386
|
+
* ✅ **Commercial Use:** You can use this software for commercial purposes.
|
|
387
|
+
* ✅ **Modification:** You can modify the code.
|
|
388
|
+
* ✅ **Distribution:** You can distribute this software.
|
|
389
|
+
* ✅ **Private Use:** You can use this project privately.
|
|
390
|
+
* ✅ **Patent Use:** You are granted rights to use patents related to the software.
|
|
391
|
+
* ⚠️ **Source Code Disclosure:** If you distribute modified versions of this software, you must disclose the source code under the same license terms.
|
|
392
|
+
* ⚠️ **Warranty:** The software is provided "as is," without warranty of any kind.
|
|
393
|
+
|
|
394
|
+
---
|
|
395
|
+
|
|
396
|
+
<p align="center">
|
|
397
|
+
<a href="#">⬆️ Back to Top</a>
|
|
398
|
+
</p>
|