Larus glider flight sensor system 3.9.2024
Software-In-The-Loop test and validation system
Loading...
Searching...
No Matches
KalmanVario.h
Go to the documentation of this file.
1/***********************************************************************/
25#ifndef APPLICATION_KALMANVARIO_H_
26#define APPLICATION_KALMANVARIO_H_
27
28#include "embedded_memory.h"
29#include "embedded_math.h"
30#include <stdint.h>
32
40{
41private:
42
43 // constants
44 enum
45 {
46 N = 4,
47 L = 2
48 };
49 static constexpr float Ta = 0.01f;
50 static constexpr float Ta_s_2 = Ta * Ta / 2.0f;
51 static ROM float Gain[N][L];
52
53 // variables
54 float x[N];
55
56public:
57 typedef enum// state vector components
58 {
60 } state;
61
62 KalmanVario_t ( float _x=ZERO, float v=ZERO, float a=ZERO, float a_offset=ZERO)
63 : x{_x, v, a, a_offset}
64 {}
65
66 void reset( const float altitude, const float acceleration_offset)
67 {
68 x[0] = altitude;
69 x[1] = 0.0f;
70 x[2] = 0.0f;
72 }
73
74 float update( const float altitude, const float acceleration);
75
76 inline float get_x( state index) const
77 {
78 if( index <= ACCELERATION_OFFSET)
79 return x[index];
80 else
81 return x[ACCELERATION_OBSERVED] + x[ACCELERATION_OFFSET]; // = acceleration minus offset
82 };
83};
84
85#endif /* APPLICATION_KALMANVARIO_H_ */
float a[2]
Kalman-filter-based sensor fusion observer for variometer.
Definition KalmanVario.h:40
void reset(const float altitude, const float acceleration_offset)
Definition KalmanVario.h:66
float get_x(state index) const
Definition KalmanVario.h:76
float update(const float altitude, const float acceleration)
KalmanVario_t(float _x=ZERO, float v=ZERO, float a=ZERO, float a_offset=ZERO)
Definition KalmanVario.h:62
mathematical vector of arbitrary type and size
Definition vector.h:40
defines platform-dependent algorithms and constants
#define ZERO
settings to allow compiling embedded software on a PC target
#define ROM
collection of system tuning parameters