mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-24 15:40:31 +08:00
EKF mag_fusion avoid unnecessary double promotion
This commit is contained in:
+1
-1
@@ -973,7 +973,7 @@ void Ekf::limitDeclination()
|
|||||||
const float decl_tolerance = 0.5f;
|
const float decl_tolerance = 0.5f;
|
||||||
const float decl_max = decl_reference + decl_tolerance;
|
const float decl_max = decl_reference + decl_tolerance;
|
||||||
const float decl_min = decl_reference - decl_tolerance;
|
const float decl_min = decl_reference - decl_tolerance;
|
||||||
const float decl_estimate = atan2(_state.mag_I(1) , _state.mag_I(0));
|
const float decl_estimate = atan2f(_state.mag_I(1) , _state.mag_I(0));
|
||||||
if (decl_estimate > decl_max) {
|
if (decl_estimate > decl_max) {
|
||||||
_state.mag_I(0) = h_field * cosf(decl_max);
|
_state.mag_I(0) = h_field * cosf(decl_max);
|
||||||
_state.mag_I(1) = h_field * sinf(decl_max);
|
_state.mag_I(1) = h_field * sinf(decl_max);
|
||||||
|
|||||||
Reference in New Issue
Block a user