mirror of
https://github.com/ArduPilot/ardupilot.git
synced 2026-10-02 10:23:25 +08:00
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:
committed by
Peter Barker
parent
2239fc6316
commit
7ae44d4a63
+2
-1
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user