Software Architecture and Functions (Landing)
Architecture
The landing procedure will be implemented as states within the path manager state machine. Each stage in the procedure can be represented as a stand-alone state. Each state is only responsible for calculating the desired altitude, heading/track, and airspeed.
This diagram explains where and how each state is implemented within the path manager state machine:
As the path manager state machine operates in a loop fashion, there must be a way to keep hold of where we are in the landing sequence. To do that, an enum is used to represent each landing state, as well as the original waypoint management system. When the aircraft needs to progress into the next stage of landing, the enum can be set to the next stage. Then, the state machine loops again and approaches the decision within Sensor Fusion, where it determines which state to switch to by using the enum.
Functions
Within each landing state, the calculations for each aspect we need to control are performed by a few common functions. Here is a list of them and a brief description of each.
The changingAltitude function:
Responsible for determining the desired altitude for the horizontal position of the aircraft.
Only used in the slope state to adjust vertical position.
In summary, the function projects the current GPS location to the vertical plane of the slope and runway. The X or Y coordinates of that projected point can then be used to determine the desired Z on the slope for that current location.
In the above picture, the plane is the vertical plane of the slope and runway, point P is the current location of the aircraft, point S is the aiming point, and point Q is the projected point onto the plane. The entire glide path lies in the plane depicted in the picture.
The throttleOff function:
Responsible for turning the throttle off in the flare, decrab, and touchdown states
The approachSpeed function:
Responsible for outputting an approach speed that the plane should follow during the slope state
The slowFlightSpeed function:
Responsible for outputting a desired slow flight speed during the flare and decrab state
The createSlopeWaypoints function:
Responsible for creating the stopping, aiming, and intersection waypoints for the glide path
Takes in stopping location, landing direction, stopping distance, and glide slope
Returns a structure that contains the important points
This is used in the transition state, where the landing path is calculated