Background
I’m working on itHalf of this is out of date
Reasoning Behind Restructuring
We are once again restructuring path manager! The current goal is to restructure PM so that it focuses more on path management while AM will take care of movement such as calculating roll, pitch, yaw, and adjusting throttle.
State Machine Changes
Some state names have been renamed to better reflect what is happening within the state. resetVariables
has been renamed to FlightStageSelectorMode
where PM will figure out what stage of flight needs to be executed.
The coordinateTurnElevation
state has been removed as it previously calculated roll, pitch, yaw, etc which has been passed onto AM. Now, the desired heading is calculated in one of the flight modes and is passed to AM to make movement calculations.
Main Structure of PM
A diagram of the general flow of Path Manager, including its modes, stages, and states can be found below.
PM has been sectioned into to main modes: CommsWithStateManagerMode
CommsWithSystemManagerMode
, and FlightStageSelectorMode
. Within CommsWithStateManagerMode
CommsWithSystemManagerMode
, PM will get the relevant instructions and information from AM, TM, and Sensor Fusion. This retrieval process is separated into three stages CommsWithAMStage, CommsWithTMStage, CommsWithSFStage where PM will get information from both managers and sensor fusion respectively. Note: these may be The stages originally created to get information from AM, TM, and SF have been combined into one stage depending on how State Manager sends us the informationwithin CommsWithSystemManagerMode
.
PM will then check if the drone is under manual control by receiving a WaypointType
. If it is not under manual control, it will enter FlightStageSelectorMode
, the main part of the state machine. Within this mode, PM will change flight states if triggered to do so. While flying, PM may enter any of the following flight states: Disarmed
, Takeoff
, Cruising
, Landing
, and Landed
. Note: a Preflight
state may be added. If we are in the Disarmed
state or Landed
state PM will go back to the start. However, if we are in Takeoff
, Cruising
, or Landing
, PM will execute their respective stages.
...
Important Structs
Note: These All messages to Path Manager will all be coming from State System Manager in a single packet:
SM → PM
...
Code Block |
---|
typedef struct CommandsFromSM CommandsForAM_t{ 2 WaypointType waypoint_type; // not necessary 3 4 // heading unit vector and magnitude 5 float dist_xCommandsFromTM telemetry_commands; 6 float dist_y; 7 float dist_z; 8 float magnitude; // Magnitude distance to waypoint target 9 float heading; // heading at target waypoint 10 double speed_target; // Target velocity of drone approaching target 11} CommandsForAM; |
AM → PM Struct:
AM will send to PM an armed
flag to signal that we are ready to fly. Additional information TBD
Code Block |
---|
typedef struct CommandsFromAM{
bool armed;
} CommandsFromAM; |
TM → PM Struct:
JetsonToZpMovementCommand jetson_commands;
LandingInitiationCommand landing_initiation;
LosSFData sf_data;
} CommandsFromSM; |
and CV will be sending a list of waypoints during Cruise and Search (sent through TM and SM) where a single waypoint is defined in the TelemWaypointData
struct below. The start_landing
flag will be signaled when a landing pad is found.
CV/TM → PM During Cruising
Code Block |
---|
struct TelemWaypointData GpsCoordinates{ double longitude; // double lattiude; uint8_t waypoint_id; }; typedef struct TelemWaypointData CommandsFromTM{ uint8_t num_waypoints; struct GpsCoordinates gps_coords; // number of waypoints in the list intTelemWaypointData waypoint_idwaypoints[num_waypoints]; } CommandsFromTM; |
CV/TM → PM During Search For Landing Pad
Code Block |
---|
// Data given from CV/TM typedefduring search and landing struct JetsonToZpMovementCommand CommandsFroTM{ { float x; float y; float z; float heading; }; struct LandingInitiationCommand { bool start_landing; }; |
PM → AM Struct:
Code Block |
---|
typedef struct CommandsForAM_t{ float dist_forward; //pitch float dist_right; // roll intfloat num_waypointsdist_up; //yaw float magnitude; // number of waypoints in the list TelemWaypointData waypoints[num_waypoints]; } CommandsFromTM; Magnitude distance to waypoint target float heading; // heading at target waypoint double velocity_target; // Target velocity of drone approaching target } CommandsForAM; |