Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

GOAL: Stream GLOBAL_POSITION_INT & ATTITUDE messages to the ground station to be displayed on Mission Planner.

TM Will:

  1. Drone to Ground Station Communication via RFD 900 Radio

    1. RX

      1. Receive raw MAVLink bytes from the ground station.

    2. TX

      1. Transmit raw MAVLink bytes from the ground station.

  2. Encode & Decode Raw MAVLink Data

    1. Encode

      1. Into Mavlink bytes to send to Mission Planner transmitted via RFD 900

    2. Decode

      1. Decode raw Mavlink bytes received from Mission Planner, received via RFD 900.

  3. Ingest Drone State Data (Lat, Lng, Velocity, Pitch, etc) via C++ references

    1. Should these references be passed at TM instantiation?

    2. Is there a finite list of drone state data TM will be ingesting?

    3. Sample rate?

  4. TM will communicate with other managers via [UNDEFINED COMMUNICATION MEDIUM]: Maybe for TM, this should go in M3?

    1. ROS LCM?

    2. Byte Streams?

    3. MQTT Style?

  5. TM will have an input/output testing strategy

    1. ?

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

  • If the received buffer has space dump bytes into it otherwise disregard the received data

Timer Based Interrupt

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);
}
  • No labels