Browse Source

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

By setting ATT_W_MAG to 0
sbg
Beat Küng 7 years ago committed by Lorenz Meier
parent
commit
54fac26327
  1. 8
      src/modules/attitude_estimator_q/attitude_estimator_q_main.cpp
  2. 2
      src/modules/attitude_estimator_q/attitude_estimator_q_params.c

8
src/modules/attitude_estimator_q/attitude_estimator_q_main.cpp

@ -39,6 +39,7 @@ @@ -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) @@ -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);

2
src/modules/attitude_estimator_q/attitude_estimator_q_params.c

@ -54,6 +54,8 @@ PARAM_DEFINE_FLOAT(ATT_W_ACC, 0.2f); @@ -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

Loading…
Cancel
Save