The Radio Telemetry Tracker Drone Communications Package is a Python-based library designed to facilitate the transmission, reception, and handling of protobuf-based radio packets between a drone's field device software (FDS) and the ground control station (GCS). It implements reliable communication through packet acknowledgements, serialization/deserialization of Protobuf messages, and provides an extendable structure for new message types.
Note: This package is not intended for end-user use in standalone mode. Rather, it is a shared component that is consumed by the FDS and GCS repositories. Therefore, detailed user-facing instructions are provided in the respective repositories where this package is integrated.
This package provides:
- Packet Definitions: Protobuf message definitions for radio telemetry data and requests
- Codec: Encoding/decoding logic with framing, CRC checks, and synchronization markers
- Radio Interfaces:
- SerialRadioInterface: For physical serial (UART) connections
- SimulatedRadioInterface: For TCP-based simulation and testing
- Packet Management: Reliable transmission with retry and acknowledgment (ACK) mechanisms
- DroneComms Class: High-level API with typed handlers and callback registration
- Python 3.12 or later
- Poetry 1.8 or later
- For serial communication:
pyserial
- For protocol buffers:
protobuf
,grpcio-tools
-
Add as a dependency to your project:
poetry add git+https://github.com/UCSD-E4E/radio-telemetry-tracker-drone-comms-package.git
-
Or clone for development:
git clone https://github.com/UCSD-E4E/radio-telemetry-tracker-drone-comms-package.git cd radio-telemetry-tracker-drone-comms-package poetry install
The library supports two interface types:
- Serial Interface:
from radio_telemetry_tracker_drone_comms_package import RadioConfig
config = RadioConfig(
interface_type="serial",
port="/dev/ttyUSB0", # Serial port
baudrate=56700, # Communication speed
)
- Simulated Interface (for testing):
config = RadioConfig(
interface_type="simulated",
host="localhost", # TCP host
tcp_port=50000, # TCP port
server_mode=False, # Client/server mode
)
Basic usage pattern:
from radio_telemetry_tracker_drone_comms_package import DroneComms, RadioConfig, GPSData
-
Initialize communications:
config = RadioConfig(interface_type="serial", port="/dev/ttyUSB0") comms = DroneComms(radio_config=config)
-
Register handlers for incoming packets:
def on_gps_data(data: GPSData): print(f"GPS: {data.easting}, {data.northing}, {data.altitude}") comms.register_gps_handler(on_gps_data)
-
Start communication:
comms.start() # Opens the radio interface and starts Rx/Tx threads
-
Send packets as needed:
comms.send_sync_request(SyncRequestData())
-
Clean up when done:
comms.stop() # Closes the radio interface and stops threads
Common issues and solutions:
-
No Packets Received
- Check physical connections (serial) or network connectivity (TCP)
- Verify correct port/baudrate settings
- Look for exceptions in logs
-
CRC Errors
- Ensure matching Protobuf versions between FDS and GCS
- Check for packet framing issues
- Verify byte order consistency
-
Timeouts
- Increase
read_timeout
orack_timeout
for slow/unreliable links - Check for network congestion or interference
- Verify both ends are running and properly configured
- Increase
This project is licensed under the terms specified in the LICENSE file.