mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 04:45:31 +08:00
refs #865, set on ground flag in interpolator
This commit is contained in:
committed by
Mathew Sutcliffe
parent
3c7eb6ea28
commit
336fda23c9
@@ -115,6 +115,48 @@ namespace BlackMisc
|
|||||||
situation.setGroundElevation(elevation);
|
situation.setGroundElevation(elevation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IInterpolator::setGroundFlagFromInterpolator(const CInterpolationHints &hints, double groundFactor, CAircraftSituation &situation)
|
||||||
|
{
|
||||||
|
// by interpolation
|
||||||
|
if (groundFactor >= 1.0)
|
||||||
|
{
|
||||||
|
situation.setOnGround(CAircraftSituation::OnGround, CAircraftSituation::OnGroundByInterpolation);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (groundFactor < 1.0 && groundFactor >= 0.0)
|
||||||
|
{
|
||||||
|
situation.setOnGround(CAircraftSituation::NotOnGround, CAircraftSituation::OnGroundByInterpolation);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// no value by factor, guess on elevation
|
||||||
|
const CLength heightAboveGround(situation.getHeightAboveGround());
|
||||||
|
const CLength cgAboveGround(hints.getCGAboveGround());
|
||||||
|
if (!heightAboveGround.isNull())
|
||||||
|
{
|
||||||
|
const bool og = cgAboveGround.isNull() ?
|
||||||
|
heightAboveGround.value(CLengthUnit::m()) < 1.0 :
|
||||||
|
heightAboveGround <= cgAboveGround;
|
||||||
|
situation.setOnGround(og ? CAircraftSituation::OnGround : CAircraftSituation::NotOnGround, CAircraftSituation::OnGroundByElevation);
|
||||||
|
}
|
||||||
|
|
||||||
|
// for VTOL aircraft we give up
|
||||||
|
if (hints.isVtolAircraft())
|
||||||
|
{
|
||||||
|
situation.setOnGround(CAircraftSituation::OnGroundSituationUnknown, CAircraftSituation::OnGroundReliabilityNoSet);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// we guess on speed, pitch and bank by excluding situations
|
||||||
|
situation.setOnGround(CAircraftSituation::NotOnGround, CAircraftSituation::OnGroundByGuessing);
|
||||||
|
if (qAbs(situation.getPitch().value(CAngleUnit::deg())) > 10) { return; }
|
||||||
|
if (qAbs(situation.getBank().value(CAngleUnit::deg())) > 10) { return; }
|
||||||
|
if (situation.getGroundSpeed().value(CSpeedUnit::km_h()) > 50) { return; }
|
||||||
|
|
||||||
|
// not sure, but this is a guess
|
||||||
|
situation.setOnGround(CAircraftSituation::OnGround, CAircraftSituation::OnGroundByGuessing);
|
||||||
|
}
|
||||||
|
|
||||||
bool IInterpolator::InterpolationStatus::allTrue() const
|
bool IInterpolator::InterpolationStatus::allTrue() const
|
||||||
{
|
{
|
||||||
return m_interpolationSucceeded && m_changedPosition;
|
return m_interpolationSucceeded && m_changedPosition;
|
||||||
|
|||||||
@@ -142,6 +142,9 @@ namespace BlackMisc
|
|||||||
//! Set the ground elevation from hints, if possible and not already set
|
//! Set the ground elevation from hints, if possible and not already set
|
||||||
static void setGroundElevationFromHint(const CInterpolationHints &hints, BlackMisc::Aviation::CAircraftSituation &situation);
|
static void setGroundElevationFromHint(const CInterpolationHints &hints, BlackMisc::Aviation::CAircraftSituation &situation);
|
||||||
|
|
||||||
|
//! Set on ground flag
|
||||||
|
static void setGroundFlagFromInterpolator(const CInterpolationHints &hints, double groundFactor, BlackMisc::Aviation::CAircraftSituation &situation);
|
||||||
|
|
||||||
CInterpolationAndRenderingSetup m_setup; //!< allows to disable debug messages
|
CInterpolationAndRenderingSetup m_setup; //!< allows to disable debug messages
|
||||||
mutable QReadWriteLock m_lock; //!< lock interpolator
|
mutable QReadWriteLock m_lock; //!< lock interpolator
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -158,6 +158,13 @@ namespace BlackMisc
|
|||||||
oldAlt.getReferenceDatum()));
|
oldAlt.getReferenceDatum()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
IInterpolator::setGroundFlagFromInterpolator(hints, groundFactor, currentSituation);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// guess ground flag
|
||||||
|
constexpr double NoGroundFactor = -1;
|
||||||
|
IInterpolator::setGroundFlagFromInterpolator(hints, NoGroundFactor, currentSituation);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!setup.isForcingFullInterpolation() && !hints.isVtolAircraft() && newVec == oldVec && oldAlt == newAlt)
|
if (!setup.isForcingFullInterpolation() && !hints.isVtolAircraft() && newVec == oldVec && oldAlt == newAlt)
|
||||||
|
|||||||
Reference in New Issue
Block a user