...
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 will then 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 will all be coming from State Manager
PM → AM Struct:
Code Block |
---|
typedef struct CommandsForAM_t{
WaypointType waypoint_type;
// heading unit vector and magnitude
float heading_dist_x;
float heading_dist_y;
float heading_dist_z;
float heading_magnitude; // Magnitude distance to waypoint target
double velocity_target; // Target velocity of drone approaching target
} 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 Waypoint Struct:
CV will be sending a list of waypoints during Cruise and Search (sent through TM and SM) where a waypoint is defined below. The start_landing
flag will be signaled when a landing pad is found.
Code Block |
---|
struct GpsCoordinates{
double longitude;
double lattiude;
};
struct TelemWaypointData {
struct GpsCoordinates gps_coords;
int waypoint_id;
};
typedef struct CommandsFroTM{
bool start_landing;
int num_waypoints; // number of waypoints in the list
TelemWaypointData waypoints[num_waypoints];
} CommandsFromTM;
|