/** * After take-off has been detected, we check if the ground speed goes * below a certain threshold that indicates the aircraft has ceased * flying. To avoid false positives while wave/ridge soaring, this * threshold is half of the given take-off speed. */ gcc_pure static bool CheckLandingSpeed(fixed takeoff_speed, const NMEAInfo &basic) { return !CheckTakeOffSpeed(Half(takeoff_speed), basic); }
void FlyingComputer::Compute(fixed takeoff_speed, const NMEAInfo &basic, const DerivedInfo &calculated, FlyingState &flying) { if (!basic.time_available || !basic.location_available) return; const fixed dt = delta_time.Update(basic.time, fixed(0.5), fixed(20)); if (negative(dt)) { Reset(); flying.Reset(); } if (!positive(dt)) return; const auto any_altitude = basic.GetAnyAltitude(); if (!basic.airspeed_available && !calculated.altitude_agl_valid && any_altitude.first && !negative(last_ground_altitude) && any_altitude.second > last_ground_altitude + fixed(250)) { /* lower the threshold for "not moving" when the aircraft is high above the take-off airfield and there's no airspeed probe; this shall reduce the risk of false landing detection when flying in strong head wind (e.g. ridge or wave) */ fixed dh = any_altitude.second - last_ground_altitude; if (dh > fixed(1000)) takeoff_speed /= 4; else if (dh > fixed(500)) takeoff_speed /= 2; else takeoff_speed = takeoff_speed * 2 / 3; } if (CheckTakeOffSpeed(takeoff_speed, basic) || CheckAltitudeAGL(calculated)) Moving(flying, basic.time, dt, basic.location); else if (!flying.flying || (CheckLandingSpeed(takeoff_speed, basic) && (!any_altitude.first || !CheckClimbing(dt, any_altitude.second)))) Stationary(flying, basic.time, dt, basic.location); if (basic.engine_noise_level_available) CheckPowered(dt, basic, flying); if (any_altitude.first) { if (flying.on_ground) last_ground_altitude = any_altitude.second; CheckRelease(flying, basic.time, basic.location, any_altitude.second); } else sinking_since = fixed(-1); if (flying.flying && flying.release_location.IsValid()) { fixed distance = basic.location.Distance(flying.release_location); if (distance > flying.far_distance) { flying.far_location = basic.location; flying.far_distance = distance; } } }
/** * After take-off has been detected, we check if the ground speed goes * below a certain threshold that indicates the aircraft has ceased * flying. To avoid false positives while wave/ridge soaring, this * threshold is half of the given take-off speed. */ gcc_pure static bool CheckLandingSpeed(double takeoff_speed, const NMEAInfo &basic) { return !CheckTakeOffSpeed(takeoff_speed / 2, basic); }