From 4e928bf2940a09afcb6ce8de136e8afa53d462ba Mon Sep 17 00:00:00 2001 From: Paul Riseborough Date: Thu, 15 Oct 2015 21:54:45 +1100 Subject: [PATCH] AP_NavEKF2: Fix bug preventing pre-takeoff reference measurements --- libraries/AP_NavEKF2/AP_NavEKF2_VehicleStatus.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/AP_NavEKF2/AP_NavEKF2_VehicleStatus.cpp b/libraries/AP_NavEKF2/AP_NavEKF2_VehicleStatus.cpp index 70db557346..a73f8f5df0 100644 --- a/libraries/AP_NavEKF2/AP_NavEKF2_VehicleStatus.cpp +++ b/libraries/AP_NavEKF2/AP_NavEKF2_VehicleStatus.cpp @@ -351,7 +351,7 @@ void NavEKF2_core::detectFlight() prevInFlight = inFlight; // Store vehicle height and range prior to takeoff for use in post takeoff checks - if (!onGround && !prevOnGround) { + if (onGround && prevOnGround) { // store vertical position at start of flight to use as a reference for ground relative checks posDownAtTakeoff = stateStruct.position.z; // store the range finder measurement which will be used as a reference to detect when we have taken off