GOAL: Stream GLOBAL_POSITION_INT & ATTITUDE messages to the ground station to be displayed on Mission Planner.
Thread 1 (translateToMavlinkThread)
/** * @brief This thread is responsible for taking the bytes from the GSC.DMAReceiveBuffer and * converting them to Mavlink messages/triggering the callbacks associated with each mavlink * message. */ void translateToMavlinkThread() { while (true) { MT.bytesToMavlinkMsg(GSC.DMAReceiveBuffer); vTaskDelay(pdMS_TO_TICKS(10)); // Adjust the delay as necessary } }
Thread 2 (mavlinkToBytesThread)
/** * @brief This thread is responsible for taking data from other managers and converting * them to mavlink bytes, then putting them into GSC.lowPriorityTransmitBuffer. */ void mavlinkToBytesThread() { while (true) { // START: fill GSC.lowPriorityTransmitBuffer with data to transmit // END: fill GSC.lowPriorityTransmitBuffer with data to transmit vTaskDelay(pdMS_TO_TICKS(10)); // Adjust the delay as necessary } }
DMA
void GroundStationComms::sendToGroundStation(CircularBuffer &transmissionBuffer) { // Send the bytes in transmissionBuffer to the ground station via RFD900 } void GroundStationComms::receiveFromGroundStationISR() { // if GSC.DMAReceiveBuffer has enough space for the new data add it //otherwise discard the data //end of ISR }
Timer Based Interrupt
void TimerInterrupt::registerTimerInterrupt(int timeIntervalMs, void (*function)()) { // execute the function every timeIntervalMs using a timer interrupt on the STM32 function(); }
Timer Interrupt 1 (Low priority transmission)
/** * @brief This interrupt service routine is called every 500ms. It is responsible for * sending non routine data to the ground station. Such as arm disarmed message status, * fufilling data requests from the ground station etc. This is the lowest priority data * in the GSC.lowPriorityTransmitBuffer. */ void TimerISR500ms() { // transmit low priority the data via GSC.sendToGroundStation(); function GSC.sendToGroundStation(GSC.lowPriorityTransmitBuffer); }
Timer Interrupt 2 (High priority transmission)
/** * @brief This interrupt service routine is called every 1000ms. It is responsible for * sending the highest priority drone "state" data to the ground station. Data such as * heartbeat message, altitude, attitude, latitude, longitude... And anything else deemed * important enough to be transmitted at a regular interval. This is the highest priority * data in the GSC.highPriorityTransmitBuffer. * */ void TimerISR1000ms() { // START: ingest drone state data and pack bytes into GSC.highPriorityTransmitBuffer // END: ingest drone state data and pack bytes into GSC.highPriorityTransmitBuffer // transmit the data via GSC.sendToGroundStation(); function GSC.sendToGroundStation(GSC.highPriorityTransmitBuffer); }
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
?
Add Comment