Drone PM Restructure

 

The general approach to implementing the drone code into PM is as follows:

#define IS_FIXED_WING FALSE #if IS_FIXED_WING //fixed wing code #else //drone code #endif

Things we have done

  • pathStateClasses.hpp

    • #include "TelemPathInterface.hpp"
    • //for drone code class commsWithTelemetry : public pathManagerState {     public:         // other code is here         static fijo* GetTelemetryIncomingData(void) {return &_incomingData;}     private:         //commsWithTelemetry() setup code is here         static fijo _incomingData; // Stores the commands sent by telemetry for easy access by other states in the pathmanager'         };
  • pathStateClasses.cpp

    • changed all instances of PIGO struct to fijo for drone code

      • fijo commsWithTelemetry::_incomingData;

  • pathStateClasses.cpp and hpp

    • declared incoming telem data as fijo…may not recognize it…look at “Things to do“ for more info

    • deleted the unneeded takeoff and landing stages

    • Currently working on merging the initialization and continuous waypoint setting into one stage

    • takeoffRollStage is now preflightStage

    • and takeoffClimbStage is now takeoffStage

  • WaypointManager.hpp

    • updated _PathData, _WaypointOutputType, and _WaypointManager_data_out

    • changed BUFFER_SIZE to 3 for an array to hold previous, current, and next waypoint

    • deleted anything to do with turnRadius, and inHold variables. Deleted start_circling and initialize_waypoint for orbit waypoints

  • CruisingState.hpp

    • replaced telemetry input data struct, removed inHold boolean, unsure what to do about goingHome boolean

      • initialize_waypoint, update_path_nodes, initialize_flight_path, get_next_directions

  • CommsWithTelemetry.hpp

  • redefined PM-TM (TelemPathInterface.h) and PM-AM structs (AttitudePathInterface.h) as shown below

 

Things to do

  • Comms btw AM and TM

    • Currently reviewing how we receive data from TM

    • Sending Data to AM is on hold for now

    • Unsure if we still need to send data to TM

 

As of end of Winter term the following have been finished but may not be documented:

  • Finish the different stages

    • current calculations for the AM struct is in autosteer

    • there is no AM struct back to PM → will have to see where that affects the code

    • altitude → macro

  • Determine next directions with the getNextDirectionsCommand

  • Noticed that fijo may not be recognized

  • determine if we actually need to #ifdef the whole file or if we can reduce to just snippets of code because I do not like looking through 500+ lines of code

  • we currently never have an array of waypoints → is this something we should work on implementing

  • pathStateClasses

    • look at the resetPassby function

    • look through drone code part and take out stuff we don’t need (resetPassby? Autosteer?)

    • need to look at landing and takeoff implementation and fix according to what Gordon wants

  • CruisingState and WaypointManager

    • Manav had the idea of having an array that would be constantly updated to hold the previous, current, next waypoints. Need to implement this

    • just go through code in both files and see what we need to keep/change or yeet

    • set the current waypoint (given from sensorfusion) → next = target waypoint (given from fijo, using _PathData)

  • CruisingState

    • assign waypoint types (depending on the takeoffCommand boolean?)

  • WaypointManager:

    • update rest of hpp and cpp

    • review the math for gps coordinates

    • Link the current position (given from sensor fusion) and target(future) waypoint (needing for path following math)

      • calculating desired track between target and waypoint after target (need to also link these)

    • Pathfollow requires track and position → calculate this

    • re look at initialize_waypoint, update_path_nodes, initialize_flight_path, get_next_directions, get_next_directions

    • Is there a situation where we would need to edit flight path (on the way from a→b, change to a → d → b)

    • Vector???