ArduCopter: reset attitude targets based on reset count not primary core index

this means if we change estimators that the target will also be reset
This commit is contained in:
Peter Barker
2026-06-30 15:50:15 +10:00
committed by Peter Barker
parent 2239fc6316
commit 7ae44d4a63
2 changed files with 5 additions and 5 deletions
+2 -1
View File
@@ -312,7 +312,8 @@ private:
// system time in milliseconds of last recorded yaw reset from ekf
uint32_t ekfYawReset_ms;
int8_t ekf_primary_core;
// old value of counter which increments when our attitude estimate is reset
uint16_t attitude_reset_count;
// vibration check
struct {
+3 -4
View File
@@ -257,11 +257,10 @@ void Copter::check_ekf_reset()
}
// check for change in primary EKF, reset attitude target and log. AC_PosControl handles position target adjustment
if ((ahrs.get_primary_core_index() != ekf_primary_core) && (ahrs.get_primary_core_index() != -1)) {
const auto new_reset_count = ahrs.get_last_attitude_reset_count();
if (new_reset_count != attitude_reset_count) {
attitude_control->inertial_frame_reset();
ekf_primary_core = ahrs.get_primary_core_index();
LOGGER_WRITE_ERROR(LogErrorSubsystem::EKF_PRIMARY, LogErrorCode(ekf_primary_core));
gcs().send_text(MAV_SEVERITY_WARNING, "EKF primary changed:%d", (unsigned)ekf_primary_core);
attitude_reset_count = new_reset_count;
}
}