32 #include "generated/airframe.h"
49 #ifndef V_CTL_AUTO_THROTTLE_DGAIN
50 #define V_CTL_AUTO_THROTTLE_DGAIN 0.
63 #define V_CTL_AUTO_THROTTLE_MAX_SUM_ERR 0.4
67 #ifndef V_CTL_AUTO_THROTTLE_PITCH_OF_VZ_DGAIN
68 #define V_CTL_AUTO_THROTTLE_PITCH_OF_VZ_DGAIN 0.
76 #define V_CTL_AUTO_PITCH_MAX_SUM_ERR (RadOfDeg(10.))
78 #ifndef V_CTL_AUTO_PITCH_DGAIN
79 #define V_CTL_AUTO_PITCH_DGAIN 0.
81 #ifndef V_CTL_AUTO_PITCH_IGAIN
82 #define V_CTL_AUTO_PITCH_IGAIN 0.
89 #ifndef V_CTL_PITCH_TRIM
90 #define V_CTL_PITCH_TRIM 0.
95 #ifndef V_CTL_AUTO_CLIMB_LIMIT
96 #define V_CTL_AUTO_CLIMB_LIMIT (0.5/4.0) // m/s/s
116 #define V_CTL_AUTO_AIRSPEED_PITCH_MAX_SUM_ERR (RadOfDeg(15.))
117 #define V_CTL_AUTO_AIRSPEED_THROTTLE_MAX_SUM_ERR 0.2
118 #define V_CTL_AUTO_GROUNDSPEED_MAX_SUM_ERR 100
188 #define LEAD_CTRL_TAU 0.8
189 #define LEAD_CTRL_A 1.
190 #define LEAD_CTRL_Te (1./60.)
194 static float v_ctl_climb_setpoint_last = 0.;
217 static float last_err = 0.;
225 float d_err = err - last_err;
245 static float last_err = 0.;
253 float d_err = err - last_err;
271 #define AIRSPEED_LOOP_PERIOD (1./60.)
274 static inline void v_ctl_set_airspeed(
void)
276 static float last_err_vz = 0.;
277 static float last_err_as = 0.;
284 float d_err_vz = (err_vz - last_err_vz) * AIRSPEED_LOOP_PERIOD;
285 last_err_vz = err_vz;
296 float d_err_airspeed = (err_airspeed - last_err_as) * AIRSPEED_LOOP_PERIOD;
297 last_err_as = err_airspeed;
340 static inline void v_ctl_set_groundspeed(
void)
364 v_ctl_set_airspeed();
367 v_ctl_set_groundspeed();
368 v_ctl_set_airspeed();
383 #ifdef V_CTL_THROTTLE_SLEW_LIMITER
384 #define V_CTL_THROTTLE_SLEW (1./CONTROL_FREQUENCY/(V_CTL_THROTTLE_SLEW_LIMITER))
387 #ifndef V_CTL_THROTTLE_SLEW
388 #define V_CTL_THROTTLE_SLEW (1.)
397 v_ctl_throttle_slewed += diff_throttle;
float v_ctl_auto_pitch_dgain
void v_ctl_altitude_loop(void)
outer loop
float v_ctl_auto_throttle_nominal_cruise_throttle
float v_ctl_auto_airspeed_pitch_igain
static void v_ctl_set_pitch(void)
static float stateGetHorizontalSpeedNorm_f(void)
Get norm of horizontal ground speed (float).
float v_ctl_auto_pitch_pgain
float alt
in meters (above WGS84 reference ellipsoid or above MSL)
float v_ctl_auto_airspeed_pitch_sum_err
float v_ctl_auto_groundspeed_setpoint
in meters per second
float v_ctl_auto_groundspeed_igain
void v_ctl_climb_loop(void)
Auto-throttle inner loop.
#define V_CTL_ALTITUDE_MAX_CLIMB
"New" vertical control for fixed wing vehicles.
float controlled_throttle
static float stateGetAirspeed_f(void)
Get airspeed (float).
float v_ctl_auto_pitch_sum_err
float v_ctl_auto_throttle_max_cruise_throttle
#define V_CTL_AUTO_PITCH_MAX_SUM_ERR
#define V_CTL_THROTTLE_SLEW
float v_ctl_altitude_setpoint
in meters above MSL
float v_ctl_altitude_error
in meters, (setpoint - alt) -> positive = too low
float v_ctl_auto_airspeed_setpoint
in meters per second
#define V_CTL_SPEED_AIRSPEED
float v_ctl_altitude_pre_climb
Path Angle.
float v_ctl_climb_setpoint
float v_ctl_auto_airspeed_throttle_sum_err
#define V_CTL_AUTO_GROUNDSPEED_MAX_SUM_ERR
#define V_CTL_AUTO_THROTTLE_STANDARD
float v_ctl_auto_groundspeed_sum_err
#define V_CTL_AUTO_THROTTLE_PITCH_OF_VZ_DGAIN
#define V_CTL_CLIMB_MODE_AUTO_THROTTLE
Vertical control for fixed wing vehicles.
float v_ctl_auto_throttle_sum_err
float v_ctl_altitude_pgain
#define V_CTL_AUTO_THROTTLE_DGAIN
float v_ctl_auto_throttle_igain
float v_ctl_auto_airspeed_throttle_pgain
float v_ctl_auto_airspeed_throttle_dgain
#define V_CTL_AUTO_PITCH_IGAIN
static void v_ctl_set_throttle(void)
#define V_CTL_SPEED_GROUNDSPEED
float v_ctl_pitch_setpoint
#define V_CTL_AUTO_CLIMB_LIMIT
float v_ctl_auto_airspeed_throttle_igain
float v_ctl_auto_throttle_climb_throttle_increment
static struct UtmCoor_f * stateGetPositionUtm_f(void)
Get position in UTM coordinates (float).
API to get/set the generic vehicle states.
float v_ctl_auto_throttle_pitch_of_vz_dgain
float nav_pitch
with INT32_ANGLE_FRAC
static struct EnuCoor_f * stateGetSpeedEnu_f(void)
Get ground speed in local ENU coordinates (float).
float v_ctl_auto_throttle_pitch_of_vz_pgain
#define V_CTL_SPEED_THROTTLE
#define V_CTL_AUTO_PITCH_DGAIN
uint8_t v_ctl_auto_throttle_submode
float v_ctl_auto_throttle_cruise_throttle
void v_ctl_throttle_slew(void)
Computes slewed throttle from throttle setpoint called at 20Hz.
float v_ctl_auto_airspeed_pitch_pgain
#define V_CTL_AUTO_THROTTLE_MAX_SUM_ERR
#define V_CTL_MODE_MANUAL
#define PPRZ_MODE_MANUAL
AP modes.
float v_ctl_auto_airspeed_pitch_dgain
Fixedwing Navigation library.
float v_ctl_auto_throttle_pgain
float v_ctl_auto_groundspeed_pgain
pprz_t v_ctl_throttle_slewed
float v_ctl_auto_pitch_igain
float v_ctl_auto_airspeed_controlled
pprz_t v_ctl_throttle_setpoint
float v_ctl_auto_throttle_dgain
Fixedwing autopilot modes.
float v_ctl_auto_throttle_min_cruise_throttle