mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 23:25:53 +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:
@@ -38,6 +38,7 @@
|
||||
#include "blackmisc/variant.h"
|
||||
#include "blackmisc/verify.h"
|
||||
#include "blackmisc/worker.h"
|
||||
#include "blackconfig/buildconfig.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDateTime>
|
||||
@@ -49,6 +50,7 @@
|
||||
#include <QWriteLocker>
|
||||
#include <Qt>
|
||||
|
||||
using namespace BlackConfig;
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Audio;
|
||||
using namespace BlackMisc::Aviation;
|
||||
@@ -930,15 +932,23 @@ namespace BlackCore
|
||||
if (!this->isConnectedAndNotShuttingDown()) { return; }
|
||||
|
||||
const CCallsign callsign(situation.getCallsign());
|
||||
|
||||
// checks
|
||||
Q_ASSERT_X(!callsign.isEmpty(), Q_FUNC_INFO, "Empty callsign");
|
||||
|
||||
if (CBuildConfig::isLocalDeveloperDebugBuild())
|
||||
{
|
||||
Q_ASSERT_X(!situation.isNaNVectorDouble(), Q_FUNC_INFO, "Detected NaN");
|
||||
Q_ASSERT_X(!situation.isInfVectorDouble(), Q_FUNC_INFO, "Detected inf");
|
||||
Q_ASSERT_X(situation.isValidVectorRange(), Q_FUNC_INFO, "out of range [-1,1]");
|
||||
}
|
||||
|
||||
// Interim packets do not have groundspeed, hence set the last known value.
|
||||
// If there is no full position available yet, throw this interim position away.
|
||||
CAircraftSituation interimSituation(situation);
|
||||
CAircraftSituationList history = this->remoteAircraftSituations(callsign);
|
||||
if (history.empty()) { return; } // we need one full situation at least
|
||||
const CAircraftSituation lastSituation = history.latestObject();
|
||||
const bool samePosition = (lastSituation.getPosition() == interimSituation.getPosition());
|
||||
|
||||
// changed position, continue and copy values
|
||||
interimSituation.setCurrentUtcTime();
|
||||
@@ -949,6 +959,8 @@ namespace BlackCore
|
||||
|
||||
// if we have no aircraft in range yet, we stop here
|
||||
if (!this->isAircraftInRange(callsign)) { return; }
|
||||
|
||||
const bool samePosition = lastSituation.equalNormalVectorDouble(interimSituation);
|
||||
if (samePosition) { return; } // nothing to update
|
||||
|
||||
// update aircraft
|
||||
|
||||
Reference in New Issue
Block a user