From 26de630dc5f4ab255b39d7c027efa56fc72586e8 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Sun, 1 Nov 2020 09:37:08 -0500 Subject: [PATCH] ekf2: remove landed flag and use control_status directly --- src/modules/ekf2/EKF2.cpp | 2 +- src/modules/ekf2/EKF2.hpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/modules/ekf2/EKF2.cpp b/src/modules/ekf2/EKF2.cpp index c0dabf9a38..c2b6d36383 100644 --- a/src/modules/ekf2/EKF2.cpp +++ b/src/modules/ekf2/EKF2.cpp @@ -1413,7 +1413,7 @@ void EKF2::UpdateMagCalibration(const hrt_abstime ×tamp) _ekf.get_filter_fault_status(&fault_status.value); // Check if conditions are OK for learning of magnetometer bias values - if (!_landed && _armed && + if (control_status.flags.in_air && _armed && !fault_status.value && // there are no filter faults control_status.flags.mag_3D) { // the EKF is operating in the correct mode diff --git a/src/modules/ekf2/EKF2.hpp b/src/modules/ekf2/EKF2.hpp index c6a1fe1bc7..0b2e02ce65 100644 --- a/src/modules/ekf2/EKF2.hpp +++ b/src/modules/ekf2/EKF2.hpp @@ -227,7 +227,6 @@ private: bool _distance_sensor_selected{false}; // because we can have several distance sensor instances with different orientations bool _armed{false}; bool _standby{false}; // standby arming state - bool _landed{true}; bool _in_ground_effect{false}; uORB::PublicationMulti _ekf2_timestamps_pub{ORB_ID(ekf2_timestamps)};