ekf2: Improve control of magnetometer bias learning

Adds parameters so that the motion checks used to switch between magnetic yaw and 3-axis fusion can be adjusted.
Modifies the check used to determine if learned mag biases  can be saved. A cumulated calibration time is used rather than continuous calibration time to allow for for switching in and out of 3-axis fusion mode that is required to do calibration.
This commit is contained in:
Paul Riseborough
2017-05-20 10:24:08 +02:00
committed by Lorenz Meier
parent aa69ae0ee6
commit 889fb30029
2 changed files with 73 additions and 36 deletions
+25 -1
View File
@@ -447,7 +447,7 @@ PARAM_DEFINE_INT32(EKF2_DECL_TYPE, 7);
* Type of magnetometer fusion
*
* Integer controlling the type of magnetometer fusion used - magnetic heading or 3-axis magnetometer.
* If set to automatic: heading fusion on-ground and 3-axis fusion in-flight
* If set to automatic: heading fusion on-ground and 3-axis fusion in-flight with fallback to heading fusion if there is insufficient motion to make yaw or mag biases observable.
*
* @group EKF2
* @value 0 Automatic
@@ -457,6 +457,30 @@ PARAM_DEFINE_INT32(EKF2_DECL_TYPE, 7);
*/
PARAM_DEFINE_INT32(EKF2_MAG_TYPE, 0);
/**
* Horizontal acceleration threshold used by automatic selection of magnetometer fusion method.
* This parameter is used when the magnetometer fusion method is set automatically (EKF2_MAG_TYPE = 0). If the filtered horizontal acceleration is greater than this parameter value, then the EKF will use 3-axis magnetomer fusion.
*
* @group EKF2
* @min 0.0
* @max 5.0
* @unit m/s**2
* @decimal 2
*/
PARAM_DEFINE_FLOAT(EKF2_MAG_ACCLIM, 0.5f);
/**
* Yaw rate threshold used by automatic selection of magnetometer fusion method.
* This parameter is used when the magnetometer fusion method is set automatically (EKF2_MAG_TYPE = 0). If the filtered yaw rate is greater than this parameter value, then the EKF will use 3-axis magnetomer fusion.
*
* @group EKF2
* @min 0.0
* @max 0.5
* @unit rad/s
* @decimal 2
*/
PARAM_DEFINE_FLOAT(EKF2_MAG_YAWLIM, 0.25f);
/**
* Gate size for barometric height fusion
*