![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Testing ekf implementation for Quadro_1.
EKF_RP.h@19:ccb6fc8bf872, 2019-10-28 (annotated)
- Committer:
- pmic
- Date:
- Mon Oct 28 12:08:15 2019 +0000
- Revision:
- 19:ccb6fc8bf872
- Parent:
- 13:2e03d9c03409
- Child:
- 24:e5188a2d72ca
Add increase_diag_P function so diag(P) can be increased while arming copter.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pmic | 0:a0e9705be9c4 | 1 | #ifndef EKF_RP_H_ |
pmic | 0:a0e9705be9c4 | 2 | #define EKF_RP_H_ |
pmic | 0:a0e9705be9c4 | 3 | |
pmic | 0:a0e9705be9c4 | 4 | #include <mbed.h> |
pmic | 6:f9569a07aff5 | 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_RP |
pmic | 0:a0e9705be9c4 | 10 | { |
pmic | 0:a0e9705be9c4 | 11 | public: |
pmic | 0:a0e9705be9c4 | 12 | |
pmic | 0:a0e9705be9c4 | 13 | EKF_RP(float Ts); |
pmic | 0:a0e9705be9c4 | 14 | |
pmic | 0:a0e9705be9c4 | 15 | virtual ~EKF_RP(); |
pmic | 0:a0e9705be9c4 | 16 | |
pmic | 0:a0e9705be9c4 | 17 | void reset(); |
pmic | 19:ccb6fc8bf872 | 18 | void increase_diag_P(); |
pmic | 0:a0e9705be9c4 | 19 | float get_est_state(uint8_t i); |
pmic | 0:a0e9705be9c4 | 20 | void update(float gyro_x, float gyro_y, float accel_x, float accel_y); |
pmic | 0:a0e9705be9c4 | 21 | |
pmic | 0:a0e9705be9c4 | 22 | private: |
pmic | 0:a0e9705be9c4 | 23 | |
pmic | 0:a0e9705be9c4 | 24 | float s1; |
pmic | 0:a0e9705be9c4 | 25 | float c1; |
pmic | 0:a0e9705be9c4 | 26 | float s2; |
pmic | 0:a0e9705be9c4 | 27 | float c2; |
pmic | 0:a0e9705be9c4 | 28 | |
pmic | 19:ccb6fc8bf872 | 29 | float scale_P0; |
pmic | 0:a0e9705be9c4 | 30 | float g; |
pmic | 0:a0e9705be9c4 | 31 | float kv; |
pmic | 0:a0e9705be9c4 | 32 | float Ts; |
pmic | 0:a0e9705be9c4 | 33 | float rho; |
pmic | 0:a0e9705be9c4 | 34 | Matrix <float, 2, 1> var_gy; |
pmic | 0:a0e9705be9c4 | 35 | Matrix <float, 6, 1> var_fx; |
pmic | 0:a0e9705be9c4 | 36 | |
pmic | 0:a0e9705be9c4 | 37 | Matrix <float, 2, 1> u; |
pmic | 0:a0e9705be9c4 | 38 | Matrix <float, 2, 1> y; |
pmic | 0:a0e9705be9c4 | 39 | Matrix <float, 6, 1> x; |
pmic | 0:a0e9705be9c4 | 40 | Matrix <float, 6, 6> F; |
pmic | 0:a0e9705be9c4 | 41 | Matrix <float, 2, 6> H; |
pmic | 0:a0e9705be9c4 | 42 | Matrix <float, 6, 6> Q; |
pmic | 0:a0e9705be9c4 | 43 | Matrix <float, 2, 2> R; |
pmic | 0:a0e9705be9c4 | 44 | Matrix <float, 6, 6> P; |
pmic | 0:a0e9705be9c4 | 45 | Matrix <float, 6, 2> K; |
pmic | 0:a0e9705be9c4 | 46 | Matrix <float, 6, 6> I; |
pmic | 13:2e03d9c03409 | 47 | Matrix <float, 2, 1> e; |
pmic | 0:a0e9705be9c4 | 48 | |
pmic | 0:a0e9705be9c4 | 49 | void update_angles(); |
pmic | 4:e50e18eac72b | 50 | void calc_F(); |
pmic | 4:e50e18eac72b | 51 | void calc_H(); |
pmic | 0:a0e9705be9c4 | 52 | void initialize_R(); |
pmic | 0:a0e9705be9c4 | 53 | void initialize_Q(); |
pmic | 4:e50e18eac72b | 54 | void calc_Q(); |
pmic | 0:a0e9705be9c4 | 55 | |
pmic | 0:a0e9705be9c4 | 56 | Matrix <float, 6, 1> fxd(); |
pmic | 0:a0e9705be9c4 | 57 | Matrix <float, 2, 1> gy(); |
pmic | 0:a0e9705be9c4 | 58 | |
pmic | 0:a0e9705be9c4 | 59 | }; |
pmic | 0:a0e9705be9c4 | 60 | |
pmic | 0:a0e9705be9c4 | 61 | #endif |