Larus glider flight sensor system 3.9.2024
Software-In-The-Loop test and validation system
Loading...
Searching...
No Matches
KalmanVario.cpp
Go to the documentation of this file.
1/***********************************************************************/
25#include <KalmanVario.h>
26
27ROM float KalmanVario_t::Gain[N][L]=
28 {
29 0.022706480781195f, 0.000238300640696f,
30 0.026080120255934f, 0.008557096024865f,
31 0.012200483136450f, 0.282217429952530f,
32 -0.011857330213848f, 0.000264240373951f
33 };
34
35float KalmanVario_t::update( const float altitude, const float acceleration)
36{
37 // predict x[] by propagating it through the system model
38 float x_est_0 = x[0] + Ta * x[1] + Ta_s_2 * x[2];
39 float x_est_1 = x[1] + Ta * x[2];
40 float x_est_2 = x[2];
41 float x_est_3 = x[3];
42
44 float innovation_a = acceleration - x_est_2 - x_est_3;
45
46 // x[] correction
47 x[0] = x_est_0 + Gain[0][0] * innovation_x + Gain[0][1] * innovation_a;
48 x[1] = x_est_1 + Gain[1][0] * innovation_x + Gain[1][1] * innovation_a;
49 x[2] = x_est_2 + Gain[2][0] * innovation_x + Gain[2][1] * innovation_a;
50 x[3] = x_est_3 + Gain[3][0] * innovation_x + Gain[3][1] * innovation_a;
51
52 return x[1]; // return velocity
53}
Kalman filter for variometer (interface)
float update(const float altitude, const float acceleration)
mathematical vector of arbitrary type and size
Definition vector.h:40
#define ROM