33 #include "generated/airframe.h"
43 #ifndef GUIDANCE_V_ADAPT_INITIAL_HOVER_THROTTLE
44 #ifdef GUIDANCE_V_NOMINAL_HOVER_THROTTLE
45 #define GUIDANCE_V_ADAPT_INITIAL_HOVER_THROTTLE GUIDANCE_V_NOMINAL_HOVER_THROTTLE
47 #define GUIDANCE_V_ADAPT_INITIAL_HOVER_THROTTLE 0.3
56 #ifndef GUIDANCE_V_ADAPT_MIN_HOVER_THROTTLE
57 #define GUIDANCE_V_ADAPT_MIN_HOVER_THROTTLE 0.2
65 #ifndef GUIDANCE_V_ADAPT_MAX_HOVER_THROTTLE
66 #define GUIDANCE_V_ADAPT_MAX_HOVER_THROTTLE 0.75
75 #ifndef GUIDANCE_V_ADAPT_NOISE_FACTOR
76 #define GUIDANCE_V_ADAPT_NOISE_FACTOR 1.0
83 #ifndef GUIDANCE_V_ADAPT_MAX_ACCEL
84 #define GUIDANCE_V_ADAPT_MAX_ACCEL 4.0
90 #ifndef GUIDANCE_V_ADAPT_MAX_CMD
91 #define GUIDANCE_V_ADAPT_MAX_CMD 0.9
93 #ifndef GUIDANCE_V_ADAPT_MIN_CMD
94 #define GUIDANCE_V_ADAPT_MIN_CMD 0.1
104 #ifndef GV_ADAPT_SYS_NOISE_F
105 #define GV_ADAPT_SYS_NOISE_F 0.00005
107 #define GV_ADAPT_SYS_NOISE BFP_OF_REAL(GV_ADAPT_SYS_NOISE_F, GV_ADAPT_P_FRAC)
110 #define GV_ADAPT_MEAS_NOISE_HOVER_F (50.0*GUIDANCE_V_ADAPT_NOISE_FACTOR)
111 #define GV_ADAPT_MEAS_NOISE_HOVER BFP_OF_REAL(GV_ADAPT_MEAS_NOISE_HOVER_F, GV_ADAPT_P_FRAC)
112 #define GV_ADAPT_MEAS_NOISE_OF_ZD (100.0*GUIDANCE_V_ADAPT_NOISE_FACTOR)
115 #define GV_ADAPT_P0_F 0.1
142 if (thrust_applied < gv_adapt_min_cmd || thrust_applied > gv_adapt_max_cmd
143 || zdd_meas < -gv_adapt_max_accel || zdd_meas > gv_adapt_max_accel) {
155 gv_adapt_Xmeas = (g_m_zdd + (thrust_applied >> 1)) / thrust_applied;
157 gv_adapt_Xmeas = (g_m_zdd - (thrust_applied >> 1)) / thrust_applied;
165 if (zd_ref < 0) {
ref = -
ref; }
#define ACCEL_BFP_OF_REAL(_af)
#define BFP_OF_REAL(_vr, _frac)
void gv_adapt_run(int32_t zdd_meas, int32_t thrust_applied, int32_t zd_ref)
Adaptation function.
int32_t gv_adapt_P
Covariance.
#define GUIDANCE_V_ADAPT_MAX_HOVER_THROTTLE
Maximum hover throttle as factor of MAX_PPRZ.
#define GUIDANCE_V_ADAPT_INITIAL_HOVER_THROTTLE
Initial hover throttle as factor of MAX_PPRZ.
#define GUIDANCE_V_ADAPT_MAX_ACCEL
Filter is not fed if accel values are more than +/- MAX_ACCEL.
static const int32_t gv_adapt_P0
#define GV_ADAPT_MEAS_NOISE_OF_ZD
#define GV_ADAPT_SYS_NOISE
static const int32_t gv_adapt_X0
#define GUIDANCE_V_ADAPT_MIN_CMD
#define GV_ADAPT_MEAS_NOISE_HOVER
int32_t gv_adapt_X
State of the estimator.
int32_t gv_adapt_Xmeas
Measurement.
#define GUIDANCE_V_ADAPT_MIN_HOVER_THROTTLE
Minimum hover throttle as factor of MAX_PPRZ.
#define GUIDANCE_V_ADAPT_MAX_CMD
Filter is not fed if command values are out of a % of 0/MAX_PPRZ.
Adaptation block of the vertical guidance.
PRINT_CONFIG_VAR(ONELOOP_ANDI_FILT_CUTOFF)
Paparazzi fixed point algebra.
int int32_t
Typedef defining 32 bit int type.