|
ESP-IDF Firmware
Firmware architecture and call graph
|
This class is used to process and calculate attitude from imu sensors. More...
#include <ekf_imu13states.h>
Public Member Functions | |
| ekf_imu13states () | |
| virtual | ~ekf_imu13states () |
| virtual void | Init () |
| virtual dspm::Mat | StateXdot (dspm::Mat &x, float *u) |
| virtual void | LinearizeFG (dspm::Mat &x, float *u) |
| void | Test () |
| void | TestFull (bool enable_att) |
| void | UpdateRefMeasurement (float *accel_data, float *magn_data, float R[6]) |
| void | UpdateRefMeasurementMagn (float *accel_data, float *magn_data, float R[6]) |
| void | UpdateRefMeasurement (float *accel_data, float *magn_data, float *attitude, float R[10]) |
| Public Member Functions inherited from ekf | |
| ekf (int x, int w) | |
| virtual | ~ekf () |
| virtual void | Process (float *u, float dt) |
| void | RungeKutta (dspm::Mat &x, float *u, float dt) |
| virtual void | CovariancePrediction (float dt) |
| virtual void | Update (dspm::Mat &H, float *measured, float *expected, float *R) |
| virtual void | UpdateRef (dspm::Mat &H, float *measured, float *expected, float *R) |
Data Fields | |
| dspm::Mat | mag0 |
| dspm::Mat | accel0 |
| int | NUMU |
| Data Fields inherited from ekf | |
| int | NUMX |
| int | NUMW |
| dspm::Mat & | X |
| dspm::Mat & | F |
| dspm::Mat & | G |
| dspm::Mat & | P |
| dspm::Mat & | Q |
| float * | HP |
| float * | Km |
Additional Inherited Members | |
| Static Public Member Functions inherited from ekf | |
| static dspm::Mat | quat2rotm (float q[4]) |
| static dspm::Mat | rotm2quat (dspm::Mat &R) |
| static dspm::Mat | quat2eul (const float q[4]) |
| static dspm::Mat | eul2rotm (float xyz[3]) |
| static dspm::Mat | rotm2eul (dspm::Mat &rotm) |
| static dspm::Mat | dFdq (dspm::Mat &vector, dspm::Mat &quat) |
| static dspm::Mat | dFdq_inv (dspm::Mat &vector, dspm::Mat &quat) |
| static dspm::Mat | SkewSym4x4 (float *w) |
| static dspm::Mat | qProduct (float *q) |
This class is used to process and calculate attitude from imu sensors.
The class use state vector with 13 follows values X[0..3] - attitude quaternion X[4..6] - gyroscope bias error, rad/sec X[7..9] - magnetometer vector value - magn_ampl X[10..12] - magnetometer offset value - magn_offset
where, reference magnetometer value = magn_ampl*rotation_matrix' + magn_offset
Definition at line 31 of file ekf_imu13states.h.
| ekf_imu13states::ekf_imu13states | ( | ) |
Definition at line 18 of file ekf_imu13states.cpp.
References accel0, ekf::ekf(), mag0, and NUMU.
|
virtual |
Definition at line 25 of file ekf_imu13states.cpp.
|
virtual |
Initialization of EKF. The method should be called befare the first use of the filter.
Implements ekf.
Definition at line 29 of file ekf_imu13states.cpp.
References accel0, dspm::Mat::eye(), mag0, ekf::Q, and ekf::X.
|
virtual |
Calculation of system state matrices F and G
| [in] | x | state vector |
| [in] | u | control measurement |
Implements ekf.
Definition at line 75 of file ekf_imu13states.cpp.
References dspm::Mat::data, dspm::Mat::eye(), ekf::F, ekf::G, dspm::Mat::Get(), ekf::qProduct(), ekf::quat2rotm(), ekf::SkewSym4x4(), and x.
Derivative of state vector X The default calculation: xDot = F*x + G*u It's possible to implement optimized version
| [in] | x | state vector |
| [in] | u | control measurement |
Reimplemented from ekf.
Definition at line 54 of file ekf_imu13states.cpp.
References dspm::Mat::Copy(), ekf::NUMX, ekf::SkewSym4x4(), and x.
Referenced by Test().
| void ekf_imu13states::Test | ( | ) |
Method for development and tests only.
Definition at line 104 of file ekf_imu13states.cpp.
References NUMU, and StateXdot().
| void ekf_imu13states::TestFull | ( | bool | enable_att | ) |
Method for development and tests only.
| [in] | enable_att | - enable attitude as input reference value |
Definition at line 119 of file ekf_imu13states.cpp.
References accel0, dspm::Mat::data, ekf::eul2rotm(), dspm::Mat::eye(), n, dspm::Mat::norm(), ekf::Process(), ekf::rotm2quat(), dspm::Mat::t(), UpdateRefMeasurement(), and ekf::X.
| void ekf_imu13states::UpdateRefMeasurement | ( | float * | accel_data, |
| float * | magn_data, | ||
| float * | attitude, | ||
| float | R[10] ) |
Update system state by reference measurements accelerometer, magnetometer and attitude quaternion. This method could be used when system on constant state or in initialization phase.
| [in] | accel_data | accelerometer measurement vector XYZ in g, where 1 g ~ 9.81 m/s^2 |
| [in] | magn_data | magnetometer measurement vector XYZ |
| [in] | attitude | attitude quaternion |
| [in] | R | measurement noise covariance values for diagonal covariance matrix. Then smaller value, then more you trust them. |
Definition at line 256 of file ekf_imu13states.cpp.
References accel0, dspm::Mat::Copy(), dspm::Mat::data, ekf::dFdq_inv(), dspm::Mat::eye(), dspm::Mat::norm(), ekf::NUMX, ekf::quat2rotm(), dspm::Mat::t(), ekf::Update(), and ekf::X.
| void ekf_imu13states::UpdateRefMeasurement | ( | float * | accel_data, |
| float * | magn_data, | ||
| float | R[6] ) |
Update part of system state by reference measurements accelerometer and magnetometer. Only attitude and gyro bias will be updated. This method should be used as main method after calibration.
| [in] | accel_data | accelerometer measurement vector XYZ in g, where 1 g ~ 9.81 m/s^2 |
| [in] | magn_data | magnetometer measurement vector XYZ |
| [in] | R | measurement noise covariance values for diagonal covariance matrix. Then smaller value, then more you trust them. |
Definition at line 188 of file ekf_imu13states.cpp.
References accel0, dspm::Mat::Copy(), dspm::Mat::data, ekf::dFdq_inv(), dspm::Mat::norm(), ekf::NUMX, ekf::quat2rotm(), dspm::Mat::t(), ekf::Update(), and ekf::X.
Referenced by TestFull().
| void ekf_imu13states::UpdateRefMeasurementMagn | ( | float * | accel_data, |
| float * | magn_data, | ||
| float | R[6] ) |
Update full system state by reference measurements accelerometer and magnetometer. This method should be used at calibration phase.
| [in] | accel_data | accelerometer measurement vector XYZ in g, where 1 g ~ 9.81 m/s^2 |
| [in] | magn_data | magnetometer measurement vector XYZ |
| [in] | R | measurement noise covariance values for diagonal covariance matrix. Then smaller value, then more you trust them. |
Definition at line 220 of file ekf_imu13states.cpp.
References accel0, dspm::Mat::Copy(), dspm::Mat::data, ekf::dFdq_inv(), dspm::Mat::eye(), dspm::Mat::norm(), ekf::NUMX, ekf::quat2rotm(), dspm::Mat::t(), ekf::Update(), and ekf::X.
| dspm::Mat ekf_imu13states::accel0 |
Initial reference valie for accelerometer.
Definition at line 60 of file ekf_imu13states.h.
Referenced by ekf_imu13states(), Init(), TestFull(), UpdateRefMeasurement(), UpdateRefMeasurement(), and UpdateRefMeasurementMagn().
| dspm::Mat ekf_imu13states::mag0 |
Initial reference valie for magnetometer.
Definition at line 56 of file ekf_imu13states.h.
Referenced by ekf_imu13states(), and Init().
| int ekf_imu13states::NUMU |
number of control measurements
Definition at line 65 of file ekf_imu13states.h.
Referenced by ekf_imu13states(), and Test().