Skip to content

UCSD-E4E/radio-telemetry-tracker-drone-comms-package

Repository files navigation

Radio Telemetry Tracker Drone Communications Package (Comms Package)

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.

Table of Contents

Overview

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

Prerequisites

  • Python 3.12 or later
  • Poetry 1.8 or later
  • For serial communication: pyserial
  • For protocol buffers: protobuf, grpcio-tools

Installation

  1. Add as a dependency to your project:

    poetry add git+https://github.com/UCSD-E4E/radio-telemetry-tracker-drone-comms-package.git
  2. 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

Configuration

The library supports two interface types:

  1. 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
)
  1. Simulated Interface (for testing):
config = RadioConfig(
  interface_type="simulated",
  host="localhost", # TCP host
  tcp_port=50000, # TCP port
  server_mode=False, # Client/server mode
)

Usage

Basic usage pattern:

from radio_telemetry_tracker_drone_comms_package import DroneComms, RadioConfig, GPSData
  1. Initialize communications:

    config = RadioConfig(interface_type="serial", port="/dev/ttyUSB0")
    comms = DroneComms(radio_config=config)
  2. 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)
  3. Start communication:

    comms.start()  # Opens the radio interface and starts Rx/Tx threads
  4. Send packets as needed:

    comms.send_sync_request(SyncRequestData())
  5. Clean up when done:

    comms.stop()  # Closes the radio interface and stops threads

Troubleshooting

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 or ack_timeout for slow/unreliable links
    • Check for network congestion or interference
    • Verify both ends are running and properly configured

License

This project is licensed under the terms specified in the LICENSE file.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages