mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 17:35:34 +08:00
Ref T778, some smaller style fixes/improvements
for the "underground" airplanes as reported by AK This does NOT fix the issue, but minor shortcomings found during the investigation * style * checks for "developer" env.
This commit is contained in:
committed by
Mat Sutcliffe
parent
cb814583f6
commit
373e45e958
@@ -302,7 +302,12 @@ namespace BlackMisc
|
||||
if (situationToBeUpdated.hasGroundElevation()) { return false; }
|
||||
|
||||
// if acceptable transfer
|
||||
if (oldSituation.transferGroundElevationFromMe(situationToBeUpdated)) { return true; }
|
||||
if (oldSituation.transferGroundElevationFromMe(situationToBeUpdated))
|
||||
{
|
||||
// change or keep type is the question
|
||||
// situationToBeUpdated.setGroundElevationInfo(Extrapolated);
|
||||
return true;
|
||||
}
|
||||
if (oldSituation.isNull() || olderSituation.isNull()) { return false; }
|
||||
|
||||
if (oldChange.isNull()) { return false; }
|
||||
@@ -575,7 +580,7 @@ namespace BlackMisc
|
||||
|
||||
CLength cg = m_cg.isNull() ? model.getCG() : m_cg;
|
||||
CSpeed guessedRotateSpeed = CSpeed::null();
|
||||
CSpeed sureRotateSpeed = CSpeed(130, CSpeedUnit::kts());
|
||||
CSpeed sureRotateSpeed = CSpeed(130, CSpeedUnit::kts());
|
||||
model.getAircraftIcaoCode().guessModelParameters(cg, guessedRotateSpeed);
|
||||
if (!guessedRotateSpeed.isNull())
|
||||
{
|
||||
|
||||
@@ -68,8 +68,9 @@ namespace BlackMisc
|
||||
const CElevationPlane &elevationPlane, CAircraftSituation::GndElevationInfo info, const CAircraftModel &model,
|
||||
CAircraftSituationChange *changeOut, bool *setForOnGroundPosition)
|
||||
{
|
||||
if (setForOnGroundPosition) { *setForOnGroundPosition = false; } // set a default
|
||||
if (elevationPlane.isNull()) { return 0; }
|
||||
if (this->isEmpty()) { return 0; }
|
||||
if (this->isEmpty()) { return 0; }
|
||||
|
||||
// the change has the timestamps of the latest situation
|
||||
Q_ASSERT_X(m_tsAdjustedSortHint == CAircraftSituationList::AdjustedTimestampLatestFirst || this->isSortedAdjustedLatestFirstWithoutNullPositions(), Q_FUNC_INFO, "Need sorted situations without NULL positions");
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace BlackMisc
|
||||
|
||||
CElevationPlane CCoordinateGeodeticList::averageGeodeticHeight(const CCoordinateGeodetic &reference, const CLength &range, const CLength &maxDeviation, int minValues, int sufficentValues) const
|
||||
{
|
||||
if (this->size() < minValues) { return CElevationPlane::null(); } // no change to succeed
|
||||
if (this->size() < minValues) { return CElevationPlane::null(); } // no chance to succeed
|
||||
|
||||
QList<double> valuesInFt;
|
||||
const CCoordinateGeodeticList sorted = this->findWithGeodeticMSLHeight().findWithinRange(reference, range).sortedByEuclideanDistanceSquared(reference);
|
||||
|
||||
@@ -426,9 +426,9 @@ namespace BlackMisc
|
||||
if (!situationNew.hasGroundElevation()) { continue; }
|
||||
newPosTs = situationNew.getMSecsSinceEpoch();
|
||||
kml += CKmlUtils::asPlacemark(
|
||||
QStringLiteral("%1: %2 %3 %4 alt.cor: %5").arg(n++).arg(
|
||||
QStringLiteral("%1: %2 %3 info: %4 alt.cor: %5").arg(n++).arg(
|
||||
situationNew.getFormattedUtcTimestampHmsz(),
|
||||
situationNew.getGroundElevationPlane().getAltitude().toQString(true),
|
||||
situationNew.getGroundElevationAndInfo(),
|
||||
log.elevationInfo, log.altCorrection),
|
||||
situationNew.getGroundElevationPlane().toQString(true),
|
||||
situationNew.getGroundElevationPlane(), s) % u"\n";
|
||||
|
||||
@@ -145,6 +145,16 @@ namespace BlackMisc
|
||||
BLACK_VERIFY_X(details, Q_FUNC_INFO, "Once gnd.from parts -> always gnd. from parts");
|
||||
}
|
||||
|
||||
if (CBuildConfig::isLocalDeveloperDebugBuild())
|
||||
{
|
||||
for (const CAircraftSituation &s : situations)
|
||||
{
|
||||
if (!s.hasGroundElevation()) { continue; }
|
||||
BLACK_VERIFY_X(!s.getGroundElevation().isZeroEpsilonConsidered(), Q_FUNC_INFO, "Suspicous 0 gnd. value");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// result
|
||||
return sorted && details;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace BlackMisc
|
||||
|
||||
if (CBuildConfig::isLocalDeveloperDebugBuild())
|
||||
{
|
||||
BLACK_VERIFY_X(t >= 0, Q_FUNC_INFO, "Expect t >= 0");
|
||||
BLACK_VERIFY_X(t >= 0, Q_FUNC_INFO, "Expect t >= 0");
|
||||
BLACK_VERIFY_X(t <= 1.0, Q_FUNC_INFO, "Expect t <= 1");
|
||||
}
|
||||
return y;
|
||||
@@ -225,9 +225,9 @@ namespace BlackMisc
|
||||
const double a0 = m_s[0].getCorrectedAltitude(cg).value(altUnit); // oldest
|
||||
const double a1 = m_s[1].getCorrectedAltitude(cg).value(altUnit);
|
||||
const double a2 = m_s[2].getCorrectedAltitude(cg).value(altUnit); // latest
|
||||
pa.a = {{ a0, a1, a2 }};
|
||||
pa.gnd = {{ m_s[0].getOnGroundFactor(), m_s[1].getOnGroundFactor(), m_s[2].getOnGroundFactor() }};
|
||||
pa.da = getDerivatives(pa.t, pa.a);
|
||||
pa.a = {{ a0, a1, a2 }};
|
||||
pa.gnd = {{ m_s[0].getOnGroundFactor(), m_s[1].getOnGroundFactor(), m_s[2].getOnGroundFactor() }};
|
||||
pa.da = getDerivatives(pa.t, pa.a);
|
||||
pa.dgnd = getDerivatives(pa.t, pa.gnd);
|
||||
|
||||
m_prevSampleAdjustedTime = m_s[1].getAdjustedMSecsSinceEpoch();
|
||||
@@ -257,7 +257,7 @@ namespace BlackMisc
|
||||
if (CBuildConfig::isLocalDeveloperDebugBuild())
|
||||
{
|
||||
BLACK_VERIFY_X(dt1 >= 0, Q_FUNC_INFO, "Expect postive dt1");
|
||||
BLACK_VERIFY_X(dt2 > 0, Q_FUNC_INFO, "Expect postive dt2");
|
||||
BLACK_VERIFY_X(dt2 > 0, Q_FUNC_INFO, "Expect postive dt2");
|
||||
BLACK_VERIFY_X(isAcceptableTimeFraction(timeFraction), Q_FUNC_INFO, "Expect fraction 0-1");
|
||||
}
|
||||
timeFraction = clampValidTimeFraction(timeFraction);
|
||||
@@ -334,7 +334,7 @@ namespace BlackMisc
|
||||
{
|
||||
Q_ASSERT_X(t1 < t2, Q_FUNC_INFO, "Expect sorted times, latest first"); // that means a bug in our code init the values
|
||||
BLACK_VERIFY_X(m_currentTimeMsSinceEpoc >= t1, Q_FUNC_INFO, "invalid timestamp t1");
|
||||
BLACK_VERIFY_X(m_currentTimeMsSinceEpoc < t2, Q_FUNC_INFO, "invalid timestamp t2"); // t1==t2 results in div/0
|
||||
BLACK_VERIFY_X(m_currentTimeMsSinceEpoc < t2, Q_FUNC_INFO, "invalid timestamp t2"); // t1==t2 results in div/0
|
||||
}
|
||||
if (!valid) { return CAircraftSituation::null(); }
|
||||
|
||||
|
||||
@@ -9,9 +9,12 @@
|
||||
#include "simulationenvironmentprovider.h"
|
||||
#include "blackmisc/aviation/aircraftsituationchange.h"
|
||||
|
||||
#include "verify.h"
|
||||
#include "blackmisc/verify.h"
|
||||
#include "blackconfig/buildconfig.h"
|
||||
|
||||
#include <QStringBuilder>
|
||||
|
||||
using namespace BlackConfig;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Geo;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
@@ -50,6 +53,12 @@ namespace BlackMisc
|
||||
{
|
||||
if (m_elvCoordinatesGnd.size() > m_maxElevationsGnd) { m_elvCoordinatesGnd.pop_back(); }
|
||||
m_elvCoordinatesGnd.push_front(elevationCoordinate);
|
||||
|
||||
if (CBuildConfig::isLocalDeveloperDebugBuild())
|
||||
{
|
||||
BLACK_VERIFY_X(!elevationCoordinate.geodeticHeight().isNull(), Q_FUNC_INFO, "NULL value");
|
||||
BLACK_VERIFY_X(!elevationCoordinate.geodeticHeight().isZeroEpsilonConsidered(), Q_FUNC_INFO, "Suspicous 0 value");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user