Larus glider flight sensor system 3.9.2024
Software-In-The-Loop test and validation system
Loading...
Searching...
No Matches
HP_LP_fusion.h
Go to the documentation of this file.
1/***********************************************************************/
25#ifndef HP_LP_FUSION_H_
26#define HP_LP_FUSION_H_
27
28#include "embedded_math.h"
29
31template<typename type, typename basetype> class HP_LP_fusion
32{
33public:
34 HP_LP_fusion( basetype feedback_tap) // feedback_tap shall be positive !
35 : a1( -feedback_tap),
36 old_output(0),
37 old_HP_input(0)
38 {}
39
40 type respond( type HP_input, type LP_input)
41 {
42 type new_output =
43 LP_input * (ONE + a1)
44 - HP_input * a1
45 + old_HP_input * a1
46 - old_output * a1 ;
47 old_HP_input = HP_input;
48 old_output = new_output;
49 return new_output;
50 }
51
52 operator type ( void) const
53 {
54 return old_output;
55 }
56
57private:
58 basetype a1; // a1, value usually negative
59 type old_output;
60 type old_HP_input;
61};
62
63
64
65#endif /* HP_LP_FUSION_H_ */
template for a highpass + lowpass data fusion filter
HP_LP_fusion(basetype feedback_tap)
type respond(type HP_input, type LP_input)
defines platform-dependent algorithms and constants
#define ONE