Larus glider flight sensor system 3.9.2024
Software-In-The-Loop test and validation system
Loading...
Searching...
No Matches
KalmanVario_PVA.h
Go to the documentation of this file.
1/***********************************************************************/
25#ifndef APPLICATION_KALMANVARIO_PVA_H_
26#define APPLICATION_KALMANVARIO_PVA_H_
27
28#include "embedded_memory.h"
29#include "embedded_math.h"
30#include <stdint.h>
32
41{
42private:
43
44 // constants
45 enum
46 {
47 N = 4,
48 L = 3
49 };
50 static constexpr float Ta = 0.01f;
51 static constexpr float Ta_s_2 = Ta * Ta / 2.0f;
52 static ROM float Gain[N][L];
53
54 // variables
55 float x[N];
56
57public:
58 typedef enum// state vector components
59 {
61 } state;
62
63 KalmanVario_PVA_t ( float _x=ZERO, float v=ZERO, float a=ZERO, float a_offset=ZERO)
64 : x{_x, v, a, a_offset}
65 {}
66
67 void reset( const float altitude, const float acceleration_offset)
68 {
69 x[0] = altitude;
70 x[1] = 0.0f;
71 x[2] = 0.0f;
73 }
74
75 float update( const float altitude, const float velocity, const float acceleration);
76
77 inline float get_x( state index) const
78 {
79 if( index <= ACCELERATION_OFFSET)
80 return x[index];
81 else
82 return x[ACCELERATION_OBSERVED] + x[ACCELERATION_OFFSET]; // = acceleration minus offset
83 };
84};
85
86#endif /* APPLICATION_KALMANVARIO_PVA_H_ */
float a[2]
Kalman-filter-based sensor fusion observer.
KalmanVario_PVA_t(float _x=ZERO, float v=ZERO, float a=ZERO, float a_offset=ZERO)
float update(const float altitude, const float velocity, const float acceleration)
float get_x(state index) const
void reset(const float altitude, const float acceleration_offset)
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