From 58c816197ea86586f1d8a92301d61bb94ab6b650 Mon Sep 17 00:00:00 2001 From: Roland Winklmeier Date: Fri, 16 Dec 2016 20:51:13 +0100 Subject: [PATCH] Use onGround flag only when ground speed is low OnGround flag is not synchronized with positions and causes jumps during right before takeoff and after landing. By adding a threshold currently being 20 kts, we move the jump into an area when the aircraft is still leveled. --- src/blackmisc/aviation/aircraftsituation.h | 2 +- src/plugins/simulator/fsx/simulatorfsx.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/blackmisc/aviation/aircraftsituation.h b/src/blackmisc/aviation/aircraftsituation.h index b4c05ffad..f27f28c36 100644 --- a/src/blackmisc/aviation/aircraftsituation.h +++ b/src/blackmisc/aviation/aircraftsituation.h @@ -99,7 +99,7 @@ namespace BlackMisc virtual BlackMisc::Geo::CLongitude longitude() const override { return this->m_position.longitude(); } //! Guess if aircraft is "on ground" - virtual bool isOnGroundGuessed() const; + bool isOnGroundGuessed() const; //! \copydoc Geo::ICoordinateGeodetic::geodeticHeight const BlackMisc::Aviation::CAltitude &geodeticHeight() const override { return this->m_position.geodeticHeight(); } diff --git a/src/plugins/simulator/fsx/simulatorfsx.cpp b/src/plugins/simulator/fsx/simulatorfsx.cpp index f9e64e59e..37650523b 100644 --- a/src/plugins/simulator/fsx/simulatorfsx.cpp +++ b/src/plugins/simulator/fsx/simulatorfsx.cpp @@ -846,7 +846,13 @@ namespace BlackSimPlugin if (partsStatus.isSupportingParts() && !parts.isEmpty()) { // we have parts, and use the closest ground - isOnGround = parts.front().isOnGround(); + + // \fixme onGround flag is not synchronized with positions and causes jumps during takeoff/landing. + // We need to find a better way to synchronize both. Until then, use it for a very small speed range only. + // This covers taxiing aircraft as well as a hovering helicopter. + double groundSpeedKnots = interpolatedSituation.getGroundSpeed().value(CSpeedUnit::kts()); + if (groundSpeedKnots < 50) { isOnGround = parts.front().isOnGround(); } + else { isOnGround = interpolatedSituation.isOnGroundGuessed(); } } else {