mirror of
https://github.com/ArduPilot/ardupilot.git
synced 2026-10-02 10:23:25 +08:00
ArduCopter: update reset counters when active backend changes
This commit is contained in:
committed by
Peter Barker
parent
c963865390
commit
6164e08114
+2
-2
@@ -310,8 +310,8 @@ private:
|
||||
#endif
|
||||
|
||||
|
||||
// system time in milliseconds of last recorded yaw reset from ekf
|
||||
uint32_t ekfYawReset_ms;
|
||||
// old value of counter which increments when our yaw estimate is reset
|
||||
uint16_t ahrs_yaw_reset_count;
|
||||
// old value of counter which increments when our attitude estimate is reset
|
||||
uint16_t attitude_reset_count;
|
||||
|
||||
|
||||
@@ -249,11 +249,10 @@ void Copter::check_ekf_reset()
|
||||
{
|
||||
// check for yaw reset
|
||||
float yaw_angle_change_rad;
|
||||
uint32_t new_ekfYawReset_ms = ahrs.getLastYawResetAngle(yaw_angle_change_rad);
|
||||
if (new_ekfYawReset_ms != ekfYawReset_ms) {
|
||||
const uint16_t new_yaw_reset_count = ahrs.get_yaw_reset_count(yaw_angle_change_rad);
|
||||
if (new_yaw_reset_count != ahrs_yaw_reset_count) {
|
||||
attitude_control->inertial_frame_reset();
|
||||
ekfYawReset_ms = new_ekfYawReset_ms;
|
||||
LOGGER_WRITE_EVENT(LogEvent::EKF_YAW_RESET);
|
||||
ahrs_yaw_reset_count = new_yaw_reset_count;
|
||||
}
|
||||
|
||||
// check for change in primary EKF, reset attitude target and log. AC_PosControl handles position target adjustment
|
||||
|
||||
Reference in New Issue
Block a user