Cubli library
AttitudeEstimator/AttitudeEstimator.h@2:dc7840a67f77, 2019-02-25 (annotated)
- Committer:
- fbob
- Date:
- Mon Feb 25 16:39:52 2019 +0000
- Revision:
- 2:dc7840a67f77
- Parent:
- 1:085840a3d767
Update
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
fbob | 1:085840a3d767 | 1 | #ifndef AttitudeEstimator_h |
fbob | 1:085840a3d767 | 2 | #define AttitudeEstimator_h |
fbob | 1:085840a3d767 | 3 | |
fbob | 1:085840a3d767 | 4 | #include "mbed.h" |
fbob | 1:085840a3d767 | 5 | #include "Matrix.h" |
fbob | 1:085840a3d767 | 6 | #include "LSM9DS1.h" |
fbob | 1:085840a3d767 | 7 | |
fbob | 1:085840a3d767 | 8 | // Attitude estimator class |
fbob | 1:085840a3d767 | 9 | class AttitudeEstimator |
fbob | 1:085840a3d767 | 10 | { |
fbob | 1:085840a3d767 | 11 | public: |
fbob | 1:085840a3d767 | 12 | // Class constructor |
fbob | 1:085840a3d767 | 13 | AttitudeEstimator(); |
fbob | 1:085840a3d767 | 14 | // Initialize class |
fbob | 1:085840a3d767 | 15 | void init(); |
fbob | 1:085840a3d767 | 16 | // Estimate Euler angles (rad) and angular velocities (rad/s) |
fbob | 1:085840a3d767 | 17 | void estimate(); |
fbob | 1:085840a3d767 | 18 | // |
fbob | 2:dc7840a67f77 | 19 | void get_output(); |
fbob | 2:dc7840a67f77 | 20 | // |
fbob | 1:085840a3d767 | 21 | Matrix x; |
fbob | 1:085840a3d767 | 22 | // |
fbob | 2:dc7840a67f77 | 23 | Matrix A, H, P, K, Q, R; |
fbob | 2:dc7840a67f77 | 24 | // |
fbob | 2:dc7840a67f77 | 25 | Matrix g, a, m; |
fbob | 2:dc7840a67f77 | 26 | // |
fbob | 2:dc7840a67f77 | 27 | Matrix q; |
fbob | 2:dc7840a67f77 | 28 | // |
fbob | 2:dc7840a67f77 | 29 | Matrix BN; |
fbob | 2:dc7840a67f77 | 30 | // |
fbob | 2:dc7840a67f77 | 31 | Matrix I; |
fbob | 1:085840a3d767 | 32 | private: |
fbob | 1:085840a3d767 | 33 | // |
fbob | 2:dc7840a67f77 | 34 | float dt, dt_half; |
fbob | 2:dc7840a67f77 | 35 | // |
fbob | 2:dc7840a67f77 | 36 | void read(); |
fbob | 1:085840a3d767 | 37 | // IMU sensor object |
fbob | 1:085840a3d767 | 38 | LSM9DS1 imu; |
fbob | 2:dc7840a67f77 | 39 | // |
fbob | 1:085840a3d767 | 40 | }; |
fbob | 1:085840a3d767 | 41 | |
fbob | 1:085840a3d767 | 42 | #endif |