Ideation Code
Takeoff
Get our current altitude to see if we are taking off and set the ground height
Figure out the required takeoff speed
Ask about velocity and how the fixed-wing drone actually takes off
Ask about sensor fusion and how to obtain velocity
Compute the angle to obtain the altitude, longitude, and latitude of the way points
Reverse compute turning point and intersection point based on the required velocity to reach the requested altitude
Send to whoever is controlling the engines
Variables
Sensor fusion
struct SFPathOutput_t{
float altitude; //m
float rateOfClimb; //m/s
long double latitude; //Decimal degrees
float latitudeSpeed; //m/s
long double longitude; //Decimal degrees
float longitudeSpeed; //m/s
};
Attitude Manager Input
struct AttitudeManagerInput {
float dist_forward;
float dist_right;
float dist_up;
float magnitude = 0;
float heading = 0;
double speed = 0;
};
Functions
Takeoff
AM::AttitudeManagerInput LandingTakeoffManager::createTakeoffWaypointFixedWing(const LOS::LosSFData & input)
{
AM::AttitudeManagerInput desiredWaypoint;
double currentSpeed = input.airspeed;
// rolling stage
if (currentSpeed < TAKEOFF_TARGET_SPEED_FIXED_WING) {
desiredWaypoint.dist_forward = 1;
desiredWaypoint.dist_right = 0;
desiredWaypoint.dist_up = 0;
desiredWaypoint.speed = TAKEOFF_TARGET_SPEED_FIXED_WING;
desiredWaypoint.magnitude = 0; // Use velocity controller
}
// climbing stage
else if(currentSpeed >= TAKEOFF_TARGET_SPEED_FIXED_WING){
desiredWaypoint.dist_forward = 1;
desiredWaypoint.dist_right = 0;
desiredWaypoint.dist_up = 1;
desiredWaypoint.speed = input.rateOfClimb; // TODO: Figure out if this is correct
desiredWaypoint.magnitude = 0; // Use velocity controller
}
return desiredWaypoint;
}
Landing
Compute a waypoint that is a certain height above the aiming point
Compute landing waypoint for the flaring state
Figure out the height and speed to start flaring
Compute stopping waypoint