Considerations:
Transition to landing from any state
Automated with pilot override
Initiate constant speed descent
If accurate GPS or Ground height sensor:
Gaussian profile/deceleration on approach to ground
Emergency state (Can be automatically transitioned to on coms loss)
The Plan:
Add a single landing state to path manager that calls the LandingTakeoffManager to figure out Path/speed targets
It might be good to add a “spin down” at the end where throttle is brought low before it is turned off. This is only needed if the motors start cogging when the drone turns them off (Will be added if motor cogging is noticed).
Path Manager Component:
Call the LandingTakeoffManager
to calculate the waypoints to follow to get to the ground. Feed that data into the waypoint manager.
Landing Takeoff Manager:
Use waypoints as targets that the drone attempts to meet at a set frequency. As drone approaches target, shorten the distance to the next waypoint to slow down drone ascent.
The profile to be used can be seen below:
https://www.desmos.com/calculator/kbamddthi9
Note that for low altitude landings the done will not use the higher descent velocity part of the profile right at the start and instead will be given the slower descent speed so the drone does not accelerate into the ground.
Landing Detection:
This may require a sensor or something as simple as a limit switch attached to an antenna pointed at the ground. When landing is detected, the drone will either directly transition to the next mode or move to spin down/cool off the motors
Code Prototype:
For calculating waypoint targets after the ground height sensor has been checked to see if the drone has landed.
_PathData LandingTakeoffManager::createLandingWaypoint(const SFOutput_t & input) { // Use current Lat/long if origin not known if (landingLat == -1 and landingLong == -1) { landingLat = input.latitude; landingLong = input.longitude; } _PathData desiredWaypoint; desiredWaypoint.latitude = landingLat; desiredWaypoint.longitude = landingLong; desiredWaypoint.waypointType = LANDING_WAYPOINT; int curAltitude = input.altitude; desiredWaypoint.altitude = getLandingAltitudeTarget(curAltitude, groundHeight); return desiredWaypoint; } double LandingTakeoffManager::getLandingAltitudeTarget(double curAltitude, double targetAltitude) { double waypointTarget; double droneHeight = (curAltitude - targetAltitude); if (droneHeight < 1.0) { // Touchdown speed of 0.1 m/s, set as waypoint targets at PM Freq waypointTarget = curAltitude - (0.1 / PM_FREQ); } else { // Scale descent velocity based on 0.2 * height (Eg. 0.4 m/s at 2m) // Use altitude waypoint targets geing calculated at PM Freq waypointTarget = droneHeight * (0.2 / PM_FREQ); } return waypointTarget; }
Future Landing Takeoff Manager (Not for 2022 Competition):
Use Gaussian Profile equation to generate a velocity:
Add Comment