mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 08:38:53 +08:00
ekf2-mag: never skip post-takeoff mag yaw reset
This commit is contained in:
@@ -210,9 +210,11 @@ void Ekf::controlMagFusion(const imuSample &imu_sample)
|
||||
|
||||
if (continuing_conditions_passing && _control_status.flags.yaw_align) {
|
||||
|
||||
if (checkHaglYawResetReq() || (wmm_updated && no_ne_aiding_or_not_moving)) {
|
||||
if ((checkHaglYawResetReq() && (_control_status.flags.mag_hdg || _control_status.flags.mag_3D))
|
||||
|| (wmm_updated && no_ne_aiding_or_not_moving)) {
|
||||
ECL_INFO("reset to %s", AID_SRC_NAME);
|
||||
resetMagStates(_mag_lpf.getState(), _control_status.flags.mag_hdg || _control_status.flags.mag_3D);
|
||||
const bool reset_heading = _control_status.flags.mag_hdg || _control_status.flags.mag_3D;
|
||||
resetMagStates(_mag_lpf.getState(), reset_heading);
|
||||
aid_src.time_last_fuse = imu_sample.time_us;
|
||||
|
||||
} else {
|
||||
@@ -446,7 +448,7 @@ void Ekf::resetMagStates(const Vector3f &mag, bool reset_heading)
|
||||
}
|
||||
|
||||
// record the start time for the magnetic field alignment
|
||||
if (_control_status.flags.in_air) {
|
||||
if (_control_status.flags.in_air && reset_heading) {
|
||||
_control_status.flags.mag_aligned_in_flight = true;
|
||||
_flt_mag_align_start_time = _time_delayed_us;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user