46 #include "generated/airframe.h"
50 #include "generated/flight_plan.h"
59 #ifndef APP_TARGET_SPEED
60 #define APP_TARGET_SPEED NOMINAL_AIRSPEED
62 #define MAX_WIND_ON_FINAL 0.8*APP_TARGET_SPEED
65 #define APP_ANGLE RadOfDeg(5)
68 #ifndef APP_INTERCEPT_RATE
69 #define APP_INTERCEPT_RATE 0.625 // 4s from start decent until intercept with pre_climb = -2.5 m/s
72 #ifndef APP_DISTANCE_AF_SD
73 #define APP_DISTANCE_AF_SD 100
91 float td_af = sqrtf(td_af_x * td_af_x + td_af_y * td_af_y);
101 float wind_norm = sqrtf(wind->
x * wind->
x + wind->
y * wind->
y);
102 float wind_on_final = wind_norm * (((td_af_x * wind->
y) / (td_af * wind_norm)) +
103 ((td_af_y * wind->
x) / (td_af * wind_norm)));
120 float td_sd = sqrtf(td_sd_x * td_sd_x + td_sd_y * td_sd_y);
174 float final2 =
Max(final_x * final_x + final_y * final_y, 1.);
179 float nav_final_progress = ((pos_enu->
x -
WaypointX(_tod)) * final_x +
180 (pos_enu->
y -
WaypointY(_tod)) * final_y) / final2;
181 Bound(nav_final_progress, -1, 1);
185 float pre_climb_glideslope = hspeed * (-tanf(
app_angle));
190 float alt_glideslope = start_alt + nav_final_progress * diff_alt;
196 Bound(nav_intercept_progress, -1, 1);
199 float pre_climb_intercept = -nav_intercept_progress * hspeed * (tanf(
app_angle));
205 float pre_climb = 0.;
218 pre_climb = pre_climb_intercept;
220 alt = alt_glideslope;
221 pre_climb = pre_climb_glideslope;