mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-16 13:37:34 +08:00
3D only mag fusion: make sure _flt_mag_align_complete is set
- _flt_mag_align_complete was not set when choosing pure 3D mag fusion. one effect of this was that the declination used in the filter was not the one calculated from the magnetic field states. Signed-off-by: Roman <bapstroman@gmail.com>
This commit is contained in:
+4
-3
@@ -1494,13 +1494,14 @@ void Ekf::controlMagFusion()
|
||||
|
||||
} else if (_params.mag_fusion_type == MAG_FUSE_TYPE_3D) {
|
||||
// if transitioning into 3-axis fusion mode, we need to initialise the yaw angle and field states
|
||||
if (!_control_status.flags.mag_3D) {
|
||||
_control_status.flags.yaw_align = resetMagHeading(_mag_sample_delayed.mag) || _control_status.flags.yaw_align;
|
||||
if (!_control_status.flags.mag_3D || !_flt_mag_align_complete) {
|
||||
_flt_mag_align_complete= resetMagHeading(_mag_sample_delayed.mag);
|
||||
_control_status.flags.yaw_align = _control_status.flags.yaw_align || _flt_mag_align_complete;
|
||||
}
|
||||
|
||||
// always use 3-axis mag fusion
|
||||
_control_status.flags.mag_3D = _flt_mag_align_complete;
|
||||
_control_status.flags.mag_hdg = false;
|
||||
_control_status.flags.mag_3D = true;
|
||||
|
||||
} else {
|
||||
// do no magnetometer fusion at all
|
||||
|
||||
Reference in New Issue
Block a user