Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
ekf_aw.h
Go to the documentation of this file.
1 #ifndef EKF_AW_H
2 #define EKF_AW_H
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 
8 #include "std.h"
11 
12 // Settings
14  // Q
15  float Q_accel;
16  float Q_gyro;
17  float Q_mu;
18  float Q_k;
19 
20  // R
21  float R_V_gnd;
22  float R_accel_filt[3];
23  float R_V_pitot;
24 
25  // Model Based Parameters
26  float vehicle_mass;
27 
28  // X Axis
29  float k_fx_drag[2]; // Temporary setting for fuselage + hover prop
30  float k_fx_fuselage[4];
31  float k_fx_hover[3];
32  float k_fx_wing[5];
33  float k_fx_push[3];
34  float k_fx_elev[3];
35 
36  // Y Axis
37  float k_fy_beta;
38  float k_fy_v;
39  float k_fy_wing[5];
40 
41  // Z Axis
42  float k_fz_fuselage[4];
43  float k_fz_wing[4];
44  float k_fz_hover[5];
45  float k_fz_elev[2];
46 
47  // Other options
48  bool use_model[3];
49  bool use_pitot;
52 };
53 
54 struct ekfHealth {
55  bool healthy;
57 };
58 
59 extern struct ekfAwParameters ekf_aw_params;
60 
61 // Init functions
62 extern void ekf_aw_init(void);
63 extern void ekf_aw_reset(void);
64 
65 // Filtering functions
66 extern void ekf_aw_propagate(struct FloatVect3 *acc, struct FloatRates *gyro, struct FloatEulers *euler,
67  float *pusher_RPM, float *hover_RPM_array, float *skew, float *elevator_angle, struct FloatVect3 *V_gnd,
68  struct FloatVect3 *acc_filt, float *V_pitot, float dt);
69 
70 // Getter/Setter functions
71 extern struct NedCoor_f ekf_aw_get_speed_body(void);
72 extern struct NedCoor_f ekf_aw_get_wind_ned(void);
73 extern struct NedCoor_f ekf_aw_get_offset(void);
74 extern struct FloatVect3 ekf_aw_get_innov_V_gnd(void);
75 extern struct FloatVect3 ekf_aw_get_innov_accel_filt(void);
76 extern float ekf_aw_get_innov_V_pitot(void);
77 extern void ekf_aw_get_meas_cov(float meas_cov[7]);
78 extern void ekf_aw_get_state_cov(float state_cov[9]);
79 extern void ekf_aw_get_process_cov(float process_cov[9]);
80 extern void ekf_aw_get_fuselage_force(float force[3]);
81 extern void ekf_aw_get_wing_force(float force[3]);
82 extern void ekf_aw_get_elevator_force(float force[3]);
83 extern void ekf_aw_get_hover_force(float force[3]);
84 extern void ekf_aw_get_pusher_force(float force[3]);
85 extern struct ekfAwParameters *ekf_aw_get_param_handle(void);
86 
87 extern void ekf_aw_set_speed_body(struct NedCoor_f *s);
88 extern void ekf_aw_set_wind(struct NedCoor_f *s);
89 extern void ekf_aw_set_offset(struct NedCoor_f *s);
90 extern struct ekfHealth ekf_aw_get_health(void);
91 
92 // Settings handlers
93 extern void ekf_aw_update_params(void);
94 extern void ekf_aw_reset_health(void);
95 
96 
97 // Handlers
98 #define ekf_aw_update_Q_accel(_v) { \
99  ekf_aw_params.Q_accel = _v; \
100  ekf_aw_update_params(); \
101  }
102 
103 #define ekf_aw_update_Q_gyro(_v) { \
104  ekf_aw_params.Q_gyro = _v; \
105  ekf_aw_update_params(); \
106  }
107 
108 #define ekf_aw_update_Q_mu(_v) { \
109  ekf_aw_params.Q_mu = _v; \
110  ekf_aw_update_params(); \
111  }
112 
113 #define ekf_aw_update_Q_k(_v) { \
114  ekf_aw_params.Q_k = _v; \
115  ekf_aw_update_params(); \
116  }
117 
118 #define ekf_aw_update_R_V_gnd(_v) { \
119  ekf_aw_params.R_V_gnd = _v; \
120  ekf_aw_update_params(); \
121  }
122 
123 #define ekf_aw_update_R_accel_filt_x(_v) { \
124  ekf_aw_params.R_accel_filt[0] = _v; \
125  ekf_aw_update_params(); \
126  }
127 
128 #define ekf_aw_update_R_accel_filt_y(_v) { \
129  ekf_aw_params.R_accel_filt[1] = _v; \
130  ekf_aw_update_params(); \
131  }
132 
133 #define ekf_aw_update_R_accel_filt_z(_v) { \
134  ekf_aw_params.R_accel_filt[2] = _v; \
135  ekf_aw_update_params(); \
136  }
137 
138 #define ekf_aw_update_R_V_pitot(_v) { \
139  ekf_aw_params.R_V_pitot = _v; \
140  ekf_aw_update_params(); \
141  }
142 
143 #ifdef __cplusplus
144 }
145 #endif
146 
147 #endif /* EKF_AW_H */
float Q_gyro
gyro process noise
Definition: ekf_aw.h:16
void ekf_aw_get_hover_force(float force[3])
Definition: ekf_aw.cpp:1401
float k_fy_wing[5]
Definition: ekf_aw.h:39
void ekf_aw_update_params(void)
Definition: ekf_aw.cpp:552
float ekf_aw_get_innov_V_pitot(void)
Definition: ekf_aw.cpp:1323
struct FloatVect3 ekf_aw_get_innov_accel_filt(void)
Definition: ekf_aw.cpp:1313
void ekf_aw_get_meas_cov(float meas_cov[7])
Definition: ekf_aw.cpp:1329
void ekf_aw_set_speed_body(struct NedCoor_f *s)
Definition: ekf_aw.cpp:1426
void ekf_aw_get_state_cov(float state_cov[9])
Definition: ekf_aw.cpp:1344
bool use_pitot
Definition: ekf_aw.h:49
struct NedCoor_f ekf_aw_get_speed_body(void)
Definition: ekf_aw.cpp:1265
float k_fx_wing[5]
Definition: ekf_aw.h:32
float R_V_pitot
airspeed measurement noise
Definition: ekf_aw.h:23
bool propagate_offset
Definition: ekf_aw.h:50
struct ekfHealth ekf_aw_get_health(void)
Definition: ekf_aw.cpp:1295
float vehicle_mass
Definition: ekf_aw.h:26
void ekf_aw_get_process_cov(float process_cov[9])
float k_fz_fuselage[4]
Definition: ekf_aw.h:42
float k_fz_hover[5]
Definition: ekf_aw.h:44
void ekf_aw_get_fuselage_force(float force[3])
Definition: ekf_aw.cpp:1374
float k_fx_push[3]
Definition: ekf_aw.h:33
float k_fy_beta
Definition: ekf_aw.h:37
float Q_k
offset process noise
Definition: ekf_aw.h:18
float k_fz_wing[4]
Definition: ekf_aw.h:43
float R_accel_filt[3]
filtered accel measurement noise
Definition: ekf_aw.h:22
void ekf_aw_reset_health(void)
Definition: ekf_aw.cpp:1447
float k_fx_elev[3]
Definition: ekf_aw.h:34
void ekf_aw_set_offset(struct NedCoor_f *s)
Definition: ekf_aw.cpp:1440
struct ekfAwParameters * ekf_aw_get_param_handle(void)
Definition: ekf_aw.cpp:1419
float k_fy_v
Definition: ekf_aw.h:38
void ekf_aw_propagate(struct FloatVect3 *acc, struct FloatRates *gyro, struct FloatEulers *euler, float *pusher_RPM, float *hover_RPM_array, float *skew, float *elevator_angle, struct FloatVect3 *V_gnd, struct FloatVect3 *acc_filt, float *V_pitot, float dt)
Definition: ekf_aw.cpp:591
float R_V_gnd
speed measurement noise
Definition: ekf_aw.h:21
void ekf_aw_reset(void)
Definition: ekf_aw.cpp:584
struct NedCoor_f ekf_aw_get_wind_ned(void)
Definition: ekf_aw.cpp:1275
float k_fz_elev[2]
Definition: ekf_aw.h:45
bool quick_convergence
Definition: ekf_aw.h:51
void ekf_aw_get_elevator_force(float force[3])
Definition: ekf_aw.cpp:1392
struct FloatVect3 ekf_aw_get_innov_V_gnd(void)
Definition: ekf_aw.cpp:1304
void ekf_aw_get_pusher_force(float force[3])
Definition: ekf_aw.cpp:1410
bool use_model[3]
Definition: ekf_aw.h:48
float Q_mu
wind process noise
Definition: ekf_aw.h:17
bool healthy
Definition: ekf_aw.h:55
uint16_t crashes_n
Definition: ekf_aw.h:56
void ekf_aw_get_wing_force(float force[3])
Definition: ekf_aw.cpp:1383
float k_fx_drag[2]
Definition: ekf_aw.h:29
float k_fx_hover[3]
Definition: ekf_aw.h:31
void ekf_aw_init(void)
Definition: ekf_aw.cpp:457
float k_fx_fuselage[4]
Definition: ekf_aw.h:30
struct ekfAwParameters ekf_aw_params
Definition: ekf_aw.cpp:377
void ekf_aw_set_wind(struct NedCoor_f *s)
Definition: ekf_aw.cpp:1433
float Q_accel
accel process noise
Definition: ekf_aw.h:15
struct NedCoor_f ekf_aw_get_offset(void)
Definition: ekf_aw.cpp:1285
euler angles
angular rates
static uint32_t s
Paparazzi floating point algebra.
Paparazzi floating point math for geodetic calculations.
vector in North East Down coordinates Units: meters
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
Definition: vl53l1_types.h:88