-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathKalmanFilter.h
46 lines (35 loc) · 894 Bytes
/
KalmanFilter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "stdint.h"
/*
* kalmanfilter.h
*
* Created on: 19 jul 2565
* Author: chawre
*/
#ifndef KALMANFILTER_H_
#define KALMANFILTER_H_
#include "Matrix.h"
class KalmanFilter {
private:
matrix A, B, C, D, R, G, Q;
matrix gainK, errorY, U, Y, I33;
matrix P, P_old, P_new;
matrix predictX, predictX_old, predictX_new;
matrix resultX, resultY;
float updated_U[1] = { 0 };
float updated_Ymeas[1] = { 0 };
float G_data[4] = { 0.0, 1.0, 0.0, 0.0 };
float estimateState[4] = { 0.0, 0.0, 0.0, 0.0 };
void doKalman_gain();
void doCorrect_p();
void doPredict_y();
void doCorrect();
void doPredict_x();
void doPredict_p();
void doResult();
void run();
public:
KalmanFilter(float *_A_data, float *_B_data, float *_C_data, float *_Q_data, float *_R_data);
void begin();
float *Compute(double _q, float _Vin);
};
#endif /* INC_KALMANFILTER_H_ */