mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-03 07:35:48 +08:00
Ref T397, checks on vector to find root cause NaN/inf issue
* sometimes very large numbers (xxE38) in vector * sometimes vectors which look correct, but exceed [-1,1]
This commit is contained in:
@@ -196,6 +196,10 @@ namespace BlackMisc
|
||||
// use derived interpolant function
|
||||
const bool interpolateGndFlag = pbh.getNewSituation().hasGroundDetailsForGndInterpolation() && pbh.getOldSituation().hasGroundDetailsForGndInterpolation();
|
||||
currentSituation = interpolant.interpolatePositionAndAltitude(currentSituation, interpolateGndFlag);
|
||||
if (CBuildConfig::isLocalDeveloperDebugBuild())
|
||||
{
|
||||
Q_ASSERT_X(currentSituation.isValidVectorRange(), Q_FUNC_INFO, "Invalid interpolation situation");
|
||||
}
|
||||
if (!interpolateGndFlag) { currentSituation.guessOnGround(CAircraftSituationChange::null(), m_model); }
|
||||
|
||||
// as we now have the position and can interpolate elevation
|
||||
@@ -446,6 +450,7 @@ namespace BlackMisc
|
||||
CAircraftSituation CInterpolator<Derived>::initInterpolatedSituation(const CAircraftSituation &oldSituation, const CAircraftSituation &newSituation) const
|
||||
{
|
||||
if (m_currentSituations.isEmpty()) { return CAircraftSituation::null(); }
|
||||
|
||||
CAircraftSituation currentSituation = m_lastSituation.isNull() ? m_currentSituations.front() : m_lastSituation;
|
||||
if (currentSituation.getCallsign() != m_callsign)
|
||||
{
|
||||
@@ -453,6 +458,11 @@ namespace BlackMisc
|
||||
currentSituation.setCallsign(m_callsign);
|
||||
}
|
||||
|
||||
if (CBuildConfig::isLocalDeveloperDebugBuild())
|
||||
{
|
||||
Q_ASSERT_X(currentSituation.isValidVectorRange(), Q_FUNC_INFO, "Invalid range");
|
||||
}
|
||||
|
||||
// preset elevation here, as we do not know where the situation will be after the interpolation step!
|
||||
const bool preset = currentSituation.presetGroundElevation(oldSituation, newSituation, m_pastSituationsChange);
|
||||
Q_UNUSED(preset);
|
||||
|
||||
@@ -281,6 +281,13 @@ namespace BlackMisc
|
||||
const double newY = evalSplineInterval(m_currentTimeMsSinceEpoc, t1, t2, m_pa.y[1], m_pa.y[2], m_pa.dy[1], m_pa.dy[2]);
|
||||
const double newZ = evalSplineInterval(m_currentTimeMsSinceEpoc, t1, t2, m_pa.z[1], m_pa.z[2], m_pa.dz[1], m_pa.dz[2]);
|
||||
|
||||
if (CBuildConfig::isLocalDeveloperDebugBuild())
|
||||
{
|
||||
Q_ASSERT_X(CAircraftSituation::isValidVector(m_pa.x), Q_FUNC_INFO, "invalid X"); // all x values
|
||||
Q_ASSERT_X(CAircraftSituation::isValidVector(m_pa.y), Q_FUNC_INFO, "invalid Y"); // all y values
|
||||
Q_ASSERT_X(CAircraftSituation::isValidVector(m_pa.z), Q_FUNC_INFO, "invalid Z"); // all z values
|
||||
}
|
||||
|
||||
CAircraftSituation newSituation(currentSituation);
|
||||
const std::array<double, 3> normalVector = {{ newX, newY, newZ }};
|
||||
const CCoordinateGeodetic currentPosition(normalVector);
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace BlackMisc
|
||||
void setTimes(qint64 currentTimeMs, double timeFraction, qint64 interpolatedTimeMs);
|
||||
|
||||
private:
|
||||
PosArray m_pa; //! current positions array, latest values last
|
||||
PosArray m_pa; //!< current positions array, latest values last
|
||||
PhysicalQuantities::CLengthUnit m_altitudeUnit;
|
||||
qint64 m_currentTimeMsSinceEpoc { -1 };
|
||||
};
|
||||
|
||||
@@ -262,7 +262,7 @@ namespace BlackMisc
|
||||
BLACK_VERIFY_X(situation.getTimeOffsetMs() > 0, Q_FUNC_INFO, "Missing offset");
|
||||
}
|
||||
|
||||
// add offset (for testing only)
|
||||
// add altitude offset (for testing only)
|
||||
CAircraftSituation situationCorrected(allowTestOffset ? this->addTestAltitudeOffsetToSituation(situation) : situation);
|
||||
|
||||
// CG, model
|
||||
|
||||
Reference in New Issue
Block a user