mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-25 07:23:34 +08:00
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:
@@ -39,6 +39,7 @@
|
|||||||
* @author Anton Babushkin <anton.babushkin@me.com>
|
* @author Anton Babushkin <anton.babushkin@me.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <cfloat>
|
||||||
#include <drivers/drv_hrt.h>
|
#include <drivers/drv_hrt.h>
|
||||||
#include <lib/ecl/geo/geo.h>
|
#include <lib/ecl/geo/geo.h>
|
||||||
#include <lib/ecl/geo_lookup/geo_mag_declination.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_acc, &_w_accel);
|
||||||
param_get(_params_handles.w_mag, &_w_mag);
|
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_ext_hdg, &_w_ext_hdg);
|
||||||
param_get(_params_handles.w_gyro_bias, &_w_gyro_bias);
|
param_get(_params_handles.w_gyro_bias, &_w_gyro_bias);
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,8 @@ PARAM_DEFINE_FLOAT(ATT_W_ACC, 0.2f);
|
|||||||
/**
|
/**
|
||||||
* Complimentary filter magnetometer weight
|
* Complimentary filter magnetometer weight
|
||||||
*
|
*
|
||||||
|
* Set to 0 to avoid using the magnetometer.
|
||||||
|
*
|
||||||
* @group Attitude Q estimator
|
* @group Attitude Q estimator
|
||||||
* @min 0
|
* @min 0
|
||||||
* @max 1
|
* @max 1
|
||||||
|
|||||||
Reference in New Issue
Block a user