...
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
📡 GroundStationComms
...
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.
...
Timer Interrupts: Configured for 500ms and 1000ms operation intervals.
FreeRTOS Tasks:
translateToMavlinkThread
: ProcessesGSC.DMAReceiveBuffer
bytes into MAVLink messages.mavlinkToBytesThread
: Loads MAVLink bytes intoGSC.lowPriorityTransmitBuffer
.
Scheduler: Engages the FreeRTOS scheduler for task oversight.
🗝 Function: getInstance
Description
Allows static access to the TelemetryManager object. It simply returns the TM instance.
🔄 Tasks and ISRs
translateToMavlinkThread & mavlinkToBytesThread: Converts between MAVLink messages and byte streams for drone-ground station communication.
TimerISR500ms & TimerISR1000ms: Ensures regular data dispatch from both
GSC.lowPriorityTransmitBuffer
andGSC.highPriorityTransmitBuffer
.
...