Browse Source

AP_NavEKF2: Improve is flying check for non fly forward vehicles

Will enable use of EK3_MAG_TYPE = 0 for coptersAP_NavEKF2:
master
priseborough 8 years ago committed by Andrew Tridgell
parent
commit
647db728ce
  1. 12
      libraries/AP_NavEKF2/AP_NavEKF2_VehicleStatus.cpp

12
libraries/AP_NavEKF2/AP_NavEKF2_VehicleStatus.cpp

@ -357,16 +357,24 @@ void NavEKF2_core::detectFlight() @@ -357,16 +357,24 @@ void NavEKF2_core::detectFlight()
onGround = true;
}
if (!onGround) {
// If height has increased since exiting on-ground, then we definitely are flying
if (!onGround && ((stateStruct.position.z - posDownAtTakeoff) < -1.5f)) {
if ((stateStruct.position.z - posDownAtTakeoff) < -1.5f) {
inFlight = true;
}
// If rangefinder has increased since exiting on-ground, then we definitely are flying
if (!onGround && ((rangeDataNew.rng - rngAtStartOfFlight) > 0.5f)) {
if ((rangeDataNew.rng - rngAtStartOfFlight) > 0.5f) {
inFlight = true;
}
// If more than 15 seconds armed since exiting on-ground, then we definitely are flying
if ((imuSampleTime_ms - timeAtArming_ms) > 15000) {
inFlight = true;
}
}
}
// store current on-ground and in-air status for next time

Loading…
Cancel
Save