mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-03 16:25:54 +08:00
refs #865, use CG for on ground estimation
This commit is contained in:
committed by
Mathew Sutcliffe
parent
818cdfba59
commit
8fb79f613c
@@ -241,18 +241,16 @@ namespace BlackMisc
|
|||||||
|
|
||||||
CLength CAircraftSituation::getHeightAboveGround() const
|
CLength CAircraftSituation::getHeightAboveGround() const
|
||||||
{
|
{
|
||||||
|
if (this->getAltitude().isNull()) { return { 0, nullptr }; }
|
||||||
if (this->getAltitude().getReferenceDatum() == CAltitude::AboveGround)
|
if (this->getAltitude().getReferenceDatum() == CAltitude::AboveGround)
|
||||||
{
|
{
|
||||||
// we have a sure value explicitly set
|
// we have a sure value explicitly set
|
||||||
return this->getAltitude();
|
return this->getAltitude();
|
||||||
}
|
}
|
||||||
const CLength gh(this->getGroundElevation());
|
const CLength gh(this->getGroundElevation());
|
||||||
if (!gh.isNull() && !getAltitude().isNull())
|
if (gh.isNull()) { return { 0, nullptr }; }
|
||||||
{
|
|
||||||
return this->getAltitude() - gh;
|
return this->getAltitude() - gh;
|
||||||
}
|
}
|
||||||
return { 0, nullptr };
|
|
||||||
}
|
|
||||||
|
|
||||||
CAltitude CAircraftSituation::getCorrectedAltitude() const
|
CAltitude CAircraftSituation::getCorrectedAltitude() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -73,9 +73,10 @@ namespace BlackMisc
|
|||||||
//! Reliability of on ground information
|
//! Reliability of on ground information
|
||||||
enum OnGroundReliability
|
enum OnGroundReliability
|
||||||
{
|
{
|
||||||
OnGroundByGuessing,
|
OnGroundByInterpolation, //!< strongest
|
||||||
|
OnGroundByElevationAndCG,
|
||||||
OnGroundByElevation,
|
OnGroundByElevation,
|
||||||
OnGroundByInterpolation,
|
OnGroundByGuessing, //!< weakest
|
||||||
OnGroundReliabilityNoSet
|
OnGroundReliabilityNoSet
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -303,15 +303,23 @@ namespace BlackMisc
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// no value by factor, guess on elevation
|
// on elevation and CG
|
||||||
const CLength heightAboveGround(situation.getHeightAboveGround());
|
if (!situation.getGroundElevation().isNull())
|
||||||
const CLength cgAboveGround(hints.getCGAboveGround());
|
|
||||||
if (!heightAboveGround.isNull())
|
|
||||||
{
|
{
|
||||||
const bool og = cgAboveGround.isNull() ?
|
CLength offset(hints.isVtolAircraft() ? 0.0 : 1.0, CLengthUnit::m()); // offset from ground
|
||||||
heightAboveGround.value(CLengthUnit::m()) < 1.0 :
|
CAircraftSituation::OnGroundReliability reliability = CAircraftSituation::OnGroundByElevation;
|
||||||
heightAboveGround <= cgAboveGround;
|
if (!hints.isVtolAircraft() && !hints.getCGAboveGround().isNull())
|
||||||
situation.setOnGround(og ? CAircraftSituation::OnGround : CAircraftSituation::NotOnGround, CAircraftSituation::OnGroundByElevation);
|
{
|
||||||
|
offset = hints.getCGAboveGround();
|
||||||
|
reliability = CAircraftSituation::OnGroundByElevationAndCG;
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_ASSERT_X(situation.getGroundElevation().getReferenceDatum() == CAltitude::MeanSeaLevel, Q_FUNC_INFO, "Need MSL elevation");
|
||||||
|
const CAircraftSituation::IsOnGround og =
|
||||||
|
situation.getHeightAboveGround() <= offset ?
|
||||||
|
CAircraftSituation::OnGround : CAircraftSituation::NotOnGround;
|
||||||
|
situation.setOnGround(og, reliability);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// for VTOL aircraft we give up
|
// for VTOL aircraft we give up
|
||||||
|
|||||||
Reference in New Issue
Block a user