![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Testing ekf implementation for Quadro_1.
EKF_RPY.h@12:180e09c4ea26, 2019-10-22 (annotated)
- Committer:
- pmic
- Date:
- Tue Oct 22 19:37:32 2019 +0000
- Revision:
- 12:180e09c4ea26
- Parent:
- 7:bcbcc23983de
- Child:
- 13:2e03d9c03409
Copy past altb's additional instation without m0 to EKF_RPY.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pmic | 0:a0e9705be9c4 | 1 | #ifndef EKF_RPY_H_ |
pmic | 0:a0e9705be9c4 | 2 | #define EKF_RPY_H_ |
pmic | 0:a0e9705be9c4 | 3 | |
pmic | 0:a0e9705be9c4 | 4 | #include <mbed.h> |
pmic | 0:a0e9705be9c4 | 5 | #include "Eigen/Dense.h" |
pmic | 0:a0e9705be9c4 | 6 | |
pmic | 0:a0e9705be9c4 | 7 | using namespace Eigen; |
pmic | 0:a0e9705be9c4 | 8 | |
pmic | 0:a0e9705be9c4 | 9 | class EKF_RPY |
pmic | 0:a0e9705be9c4 | 10 | { |
pmic | 0:a0e9705be9c4 | 11 | public: |
pmic | 0:a0e9705be9c4 | 12 | |
pmic | 0:a0e9705be9c4 | 13 | EKF_RPY(float Ts, float mx0, float my0, float mz0); |
pmic | 12:180e09c4ea26 | 14 | EKF_RPY(float Ts); |
pmic | 0:a0e9705be9c4 | 15 | |
pmic | 0:a0e9705be9c4 | 16 | virtual ~EKF_RPY(); |
pmic | 0:a0e9705be9c4 | 17 | |
pmic | 12:180e09c4ea26 | 18 | void set_para(); |
pmic | 0:a0e9705be9c4 | 19 | void reset(); |
pmic | 12:180e09c4ea26 | 20 | void set_m0(float mx0, float my0, float mz0); |
pmic | 0:a0e9705be9c4 | 21 | float get_est_state(uint8_t i); |
pmic | 0:a0e9705be9c4 | 22 | void update(float gyro_x, float gyro_y, float gyro_z, float accel_x, float accel_y, float magnet_x, float magnet_y); |
pmic | 0:a0e9705be9c4 | 23 | |
pmic | 0:a0e9705be9c4 | 24 | private: |
pmic | 0:a0e9705be9c4 | 25 | |
pmic | 0:a0e9705be9c4 | 26 | Matrix <float, 3, 1> m0; |
pmic | 0:a0e9705be9c4 | 27 | |
pmic | 0:a0e9705be9c4 | 28 | float s1; |
pmic | 0:a0e9705be9c4 | 29 | float c1; |
pmic | 0:a0e9705be9c4 | 30 | float s2; |
pmic | 0:a0e9705be9c4 | 31 | float c2; |
pmic | 0:a0e9705be9c4 | 32 | float s3; |
pmic | 0:a0e9705be9c4 | 33 | float c3; |
pmic | 0:a0e9705be9c4 | 34 | |
pmic | 0:a0e9705be9c4 | 35 | float g; |
pmic | 0:a0e9705be9c4 | 36 | float kv; |
pmic | 0:a0e9705be9c4 | 37 | float Ts; |
pmic | 0:a0e9705be9c4 | 38 | float rho; |
pmic | 7:bcbcc23983de | 39 | Matrix <float, 4, 1> var_gy; |
pmic | 7:bcbcc23983de | 40 | Matrix <float, 8, 1> var_fx; |
pmic | 0:a0e9705be9c4 | 41 | |
pmic | 7:bcbcc23983de | 42 | Matrix <float, 3, 1> u; |
pmic | 7:bcbcc23983de | 43 | Matrix <float, 4, 1> y; |
pmic | 7:bcbcc23983de | 44 | Matrix <float, 8, 1> x; |
pmic | 7:bcbcc23983de | 45 | Matrix <float, 8, 8> F; |
pmic | 7:bcbcc23983de | 46 | Matrix <float, 4, 8> H; |
pmic | 7:bcbcc23983de | 47 | Matrix <float, 8, 8> Q; |
pmic | 7:bcbcc23983de | 48 | Matrix <float, 4, 4> R; |
pmic | 7:bcbcc23983de | 49 | Matrix <float, 8, 8> P; |
pmic | 7:bcbcc23983de | 50 | Matrix <float, 8, 4> K; |
pmic | 7:bcbcc23983de | 51 | Matrix <float, 8, 8> I; |
pmic | 0:a0e9705be9c4 | 52 | |
pmic | 0:a0e9705be9c4 | 53 | void update_angles(); |
pmic | 7:bcbcc23983de | 54 | void calc_F(); |
pmic | 7:bcbcc23983de | 55 | void calc_H(); |
pmic | 0:a0e9705be9c4 | 56 | void initialize_R(); |
pmic | 0:a0e9705be9c4 | 57 | void initialize_Q(); |
pmic | 7:bcbcc23983de | 58 | void calc_Q(); |
pmic | 0:a0e9705be9c4 | 59 | |
pmic | 7:bcbcc23983de | 60 | Matrix <float, 8, 1> fxd(); |
pmic | 7:bcbcc23983de | 61 | Matrix <float, 4, 1> gy(); |
pmic | 0:a0e9705be9c4 | 62 | |
pmic | 0:a0e9705be9c4 | 63 | }; |
pmic | 0:a0e9705be9c4 | 64 | |
pmic | 0:a0e9705be9c4 | 65 | #endif |