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
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;
#define WaypointAlt(_wp)
waypoint altitude in m above MSL
float v_ctl_auto_airspeed_setpoint
in meters per second
static struct EnuCoor_f * stateGetPositionEnu_f(void)
Get position in local ENU coordinates (float).
static float stateGetHorizontalSpeedNorm_f(void)
Get norm of horizontal ground speed (float).
static struct FloatVect2 * stateGetHorizontalWindspeed_f(void)
Get horizontal windspeed (float).
Fixedwing Navigation library.
#define NavSegment(_start, _end)
#define NavVerticalAltitudeMode(_alt, _pre_climb)
Set the vertical mode to altitude control with the specified altitude setpoint and climb pre-command.
#define NavVerticalAutoThrottleMode(_pitch)
Set the climb control to auto-throttle with the specified pitch pre-command.
bool gls_run(uint8_t _af, uint8_t _sd, uint8_t _tod, uint8_t _td)
#define APP_DISTANCE_AF_SD
#define APP_INTERCEPT_RATE
static bool gls_compute_TOD(uint8_t _af, uint8_t _sd, uint8_t _tod, uint8_t _td)
#define MAX_WIND_ON_FINAL
bool gls_start(uint8_t _af, uint8_t _sd, uint8_t _tod, uint8_t _td)
vector in East North Up coordinates Units: meters
API to get/set the generic vehicle states.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.