...
Achieve transmission of GLOBAL_POSITION_INT & ATTITUDE MAVLink messages from the drone to the ground control station (Mission Planner) via RFD 900 radio. Any missing sensor data will be filled with sample data at this time.
🛠️ 3. Class Definitions
📡
...
GroundStationCommunication
Owner: Roni Kant
Description
Handles communication between the ground station and drone using RFD 900 or equivalent modules, utilizing circular buffers for MAVLink message management.
...
DMAReceiveBuffer
: CircularBuffer - Stores incoming data.lowPriorityTransmitBuffer
: CircularBuffer - For low-priority data dispatch.highPriorityTransmitBuffer
: CircularBuffer - For high-priority routine data dispatch.
Methods
sendToGroundStationtransmit(CircularBuffer &transmissionBuffer)
: Sends data to the ground station.receiveFromGroundStationISR()
: ISR for incoming data, discards ifDMAReceiveBuffer
is full.
...
Flexible design compatible with various communication protocols and setups.
⏲️
...
TelemetryTask
Owner:
Description
Facilitates STD32 timer interrupts for periodic callbacks, essential for consistent data dispatch to the ground station.
Method Signature
void registerTimerInterrupt(int timeIntervalMs, void (*function)())
Parameters
timeIntervalMs
: The timer interval in milliseconds.function
: The callback function.
Implementation Details
Example of function execution; real application requires STM32 timer setup.
🔄 MavlinkTranslator
This is essentially a wrapper for a FreeRTOS task that allows us to use a lambda function with access to the TM instance as a FreeRTOS task.
Constructor Signature
TelemetryTask(const char* taskName, int stackSize, UBaseType_t uxPriority, TelemetryManager& tm, Callback cbLambda)
Parameters
taskName
: The RTOS task namestackSize
: Task stack size.uxPriority
: Task priority.tm
: Reference to telemetry manager instance.cbLambda
: The callback function.
Note
Callback
is a type alias for std::function<void(TelemetryManager&)>
Implementation Details
🔄 MavlinkTranslator
Owner: Yarema Dzulynsky
Description
Translates MAVLink messages between byte streams and the drone/ground station.
...
Crucial for continuous and intermittent data handling via encoding and decoding.
🔗 CircularBuffer
Owner: Rahul Ramkumar
Description
Manages byte streams as MAVLink messages within TM components, using a circular queue/buffer for effective data buffering.
...
remainingMemory()
: Indicates available queue bytes.Returns:
int
- Available memory.
dequeue()
: Retrieves the next byte from the queue.Returns:
MAVLinkByte
- The dequeued byte.
enqueue(MAVLinkByte byte)
: Adds a byte to the queue.Parameters:
byte
:MAVLinkByte
- Byte to add.
lastFullMessageEndIndex()
: Indicates the position of the end of the last complete Mavlink message.Returns:
int
- The index of the end bit of the last complete Mavlink message.
currentIndex()
: Indicates the current position in the buffer.Returns:
int
- The current index in the buffer.
Additional Notes
A fundamental class for data integrity and memory efficiency in processing or waiting for transmission. Note, that we always check if the circular buffer has space before we add anything to it. This means that if one part of the program (MT.bytesToMavlinkMsg(GSC.DMAReceiveBuffer)) is accessing the buffer while an interrupt (GroundStationComms ISR) occurs, data integrity will remain if we ensure no overiting of data. The benefits of this approach are that we do not need to use mutex locks reducing the complexity. The drawback of this approach is that if we receive data, but the buffer is full, we need to discard the data.
🚀 Main Class Definition: System Initialization and Task Management
Owner:
Flow Chart
...
Expand | ||
---|---|---|
| ||
|
Instances
GroundStationComms GSC: Oversees ground station comms.
MavlinkTranslator MT: MAVLink message and byte stream translator.
TimerInterrupt TI: Timer-based task manager.
🌐 Function: init
Description
...
Details subsystem interactions within the project and with external entities, focusing on integration mechanisms and their objectives.
PREVIOUS PAGE IGNORE:
TM Will:
Drone to Ground Station Communication via RFD 900 Radio
RX
Receive raw MAVLink bytes from the ground station.
TX
Transmit raw MAVLink bytes from the ground station.
Encode & Decode Raw MAVLink Data
Encode
Into Mavlink bytes to send to Mission Planner transmitted via RFD 900
Decode
Decode raw Mavlink bytes received from Mission Planner, received via RFD 900.
Ingest Drone State Data (Lat, Lng, Velocity, Pitch, etc) via C++ references
Should these references be passed at TM instantiation?
Is there a finite list of drone state data TM will be ingesting?
Sample rate?
TM will communicate with other managers via [UNDEFINED COMMUNICATION MEDIUM]: Maybe for TM, this should go in M3?
ROS LCM?
Byte Streams?
MQTT Style?
TM will have an input/output testing strategy
?