From 6e363b0e762062bbd2caba796edc0fd4ad85733c Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Fri, 25 Mar 2022 11:33:29 -0400 Subject: [PATCH] ekf2: EKFGSF_yaw delete unnecessary internal state --- src/modules/ekf2/EKF/EKFGSF_yaw.cpp | 5 ++--- src/modules/ekf2/EKF/EKFGSF_yaw.h | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/modules/ekf2/EKF/EKFGSF_yaw.cpp b/src/modules/ekf2/EKF/EKFGSF_yaw.cpp index c32a82fd5c..41f049b10e 100644 --- a/src/modules/ekf2/EKF/EKFGSF_yaw.cpp +++ b/src/modules/ekf2/EKF/EKFGSF_yaw.cpp @@ -56,7 +56,6 @@ void EKFGSF_yaw::update(const imuSample &imu_sample, _delta_vel = imu_sample.delta_vel; _delta_ang_dt = imu_sample.delta_ang_dt; _delta_vel_dt = imu_sample.delta_vel_dt; - _run_ekf_gsf = run_EKF; _true_airspeed = airspeed; // to reduce effect of vibration, filter using an LPF whose time constant is 1/10 of the AHRS tilt correction time constant @@ -93,7 +92,7 @@ void EKFGSF_yaw::update(const imuSample &imu_sample, } // The 3-state EKF models only run when flying to avoid corrupted estimates due to operator handling and GPS interference - if (_run_ekf_gsf && _vel_data_updated) { + if (run_EKF && _vel_data_updated) { if (!_ekf_gsf_vel_fuse_started) { initialiseEKFGSF(); ahrsAlignYaw(); @@ -144,7 +143,7 @@ void EKFGSF_yaw::update(const imuSample &imu_sample, } } - } else if (_ekf_gsf_vel_fuse_started && !_run_ekf_gsf) { + } else if (_ekf_gsf_vel_fuse_started && !run_EKF) { // wait to fly again _ekf_gsf_vel_fuse_started = false; } diff --git a/src/modules/ekf2/EKF/EKFGSF_yaw.h b/src/modules/ekf2/EKF/EKFGSF_yaw.h index f25fa2f161..ee22eeccb6 100644 --- a/src/modules/ekf2/EKF/EKFGSF_yaw.h +++ b/src/modules/ekf2/EKF/EKFGSF_yaw.h @@ -141,7 +141,6 @@ private: } _ekf_gsf[N_MODELS_EKFGSF] {}; bool _vel_data_updated{}; // true when velocity data has been updated - bool _run_ekf_gsf{}; // true when operating condition is suitable for to run the GSF and EKF models and fuse velocity data Vector2f _vel_NE{}; // NE velocity observations (m/s) float _vel_accuracy{}; // 1-sigma accuracy of velocity observations (m/s) bool _ekf_gsf_vel_fuse_started{}; // true when the EKF's have started fusing velocity data and the prediction and update processing is active