attitude_estimator_q: allow it to be used on boards w/o a mag

By setting ATT_W_MAG to 0
This commit is contained in:
Beat Küng 2018-04-23 16:20:18 +02:00 committed by Lorenz Meier
parent 58dd7be12a
commit 54fac26327
2 changed files with 10 additions and 0 deletions

View File

@ -39,6 +39,7 @@
* @author Anton Babushkin <anton.babushkin@me.com>
*/
#include <cfloat>
#include <drivers/drv_hrt.h>
#include <lib/ecl/geo/geo.h>
#include <lib/ecl/geo_lookup/geo_mag_declination.h>
@ -473,6 +474,13 @@ void AttitudeEstimatorQ::update_parameters(bool force)
param_get(_params_handles.w_acc, &_w_accel);
param_get(_params_handles.w_mag, &_w_mag);
if (_w_mag < FLT_EPSILON) { // if the weight is zero (=mag disabled), make sure the estimator initializes
_mag(0) = 1.f;
_mag(1) = 0.f;
_mag(2) = 0.f;
}
param_get(_params_handles.w_ext_hdg, &_w_ext_hdg);
param_get(_params_handles.w_gyro_bias, &_w_gyro_bias);

View File

@ -54,6 +54,8 @@ PARAM_DEFINE_FLOAT(ATT_W_ACC, 0.2f);
/**
* Complimentary filter magnetometer weight
*
* Set to 0 to avoid using the magnetometer.
*
* @group Attitude Q estimator
* @min 0
* @max 1