mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-06 02:16:04 +08:00
Ref T241, further improved interpolation logging
* all interpolation positions can be logged (3 for spline, 2 for linear) * interpolated (log) time, setting to real time (i.e. unadjusted time) * only set logger values with logger attached
This commit is contained in:
@@ -281,15 +281,17 @@ namespace BlackMisc
|
|||||||
|
|
||||||
static const CLengthUnit ft = CLengthUnit::ft();
|
static const CLengthUnit ft = CLengthUnit::ft();
|
||||||
const SituationLog firstLog = logs.first();
|
const SituationLog firstLog = logs.first();
|
||||||
qint64 newPosTs = firstLog.situationNew.getMSecsSinceEpoch();
|
qint64 newPosTs = firstLog.newestInterpolationSituation().getMSecsSinceEpoch();
|
||||||
CAircraftParts lastParts; // default, so shown if parts are different from default
|
CAircraftParts lastParts; // default, so shown if parts are different from default
|
||||||
|
|
||||||
QString tableRows("<tbody>\n");
|
QString tableRows("<tbody>\n");
|
||||||
for (const SituationLog &log : logs)
|
for (const SituationLog &log : logs)
|
||||||
{
|
{
|
||||||
const bool changedNewPosition = newPosTs != log.situationNew.getMSecsSinceEpoch();
|
const CAircraftSituation situationOld = log.oldestInterpolationSituation();
|
||||||
|
const CAircraftSituation situationNew = log.newestInterpolationSituation();
|
||||||
|
const bool changedNewPosition = newPosTs != situationNew.getMSecsSinceEpoch();
|
||||||
const bool changedParts = (lastParts != log.parts);
|
const bool changedParts = (lastParts != log.parts);
|
||||||
newPosTs = log.situationNew.getMSecsSinceEpoch();
|
newPosTs = situationNew.getMSecsSinceEpoch();
|
||||||
lastParts = log.parts;
|
lastParts = log.parts;
|
||||||
|
|
||||||
// concatenating in multiple steps, otherwise C4503 warnings
|
// concatenating in multiple steps, otherwise C4503 warnings
|
||||||
@@ -302,8 +304,8 @@ namespace BlackMisc
|
|||||||
QStringLiteral("<td>") % msSinceEpochToTime(log.tsCurrent) % QStringLiteral("</td>") %
|
QStringLiteral("<td>") % msSinceEpochToTime(log.tsCurrent) % QStringLiteral("</td>") %
|
||||||
QStringLiteral("<td>") % QString::number(log.tsCurrent - firstLog.tsCurrent) % QStringLiteral("</td>") %
|
QStringLiteral("<td>") % QString::number(log.tsCurrent - firstLog.tsCurrent) % QStringLiteral("</td>") %
|
||||||
|
|
||||||
QStringLiteral("<td class=\"old\">") % log.situationOld.getTimestampAndOffset(true) % QStringLiteral("</td>") %
|
QStringLiteral("<td class=\"old\">") % situationOld.getTimestampAndOffset(true) % QStringLiteral("</td>") %
|
||||||
QStringLiteral("<td class=\"new\">") % log.situationNew.getTimestampAndOffset(true) % QStringLiteral("</td>") %
|
QStringLiteral("<td class=\"new\">") % situationNew.getTimestampAndOffset(true) % QStringLiteral("</td>") %
|
||||||
QStringLiteral("<td class=\"cur\">") % log.situationCurrent.getTimestampAndOffset(true) % QStringLiteral("</td>") %
|
QStringLiteral("<td class=\"cur\">") % log.situationCurrent.getTimestampAndOffset(true) % QStringLiteral("</td>") %
|
||||||
|
|
||||||
QStringLiteral("<td>") % msSinceEpochToTime(log.tsInterpolated) % QStringLiteral("</td>") %
|
QStringLiteral("<td>") % msSinceEpochToTime(log.tsInterpolated) % QStringLiteral("</td>") %
|
||||||
@@ -311,26 +313,26 @@ namespace BlackMisc
|
|||||||
QStringLiteral("<td>") % QString::number(log.simulationTimeFraction) % QStringLiteral("</td>");
|
QStringLiteral("<td>") % QString::number(log.simulationTimeFraction) % QStringLiteral("</td>");
|
||||||
|
|
||||||
tableRows +=
|
tableRows +=
|
||||||
QStringLiteral("<td class=\"old\">") % log.situationOld.latitudeAsString() % QStringLiteral("</td>") %
|
QStringLiteral("<td class=\"old\">") % situationOld.latitudeAsString() % QStringLiteral("</td>") %
|
||||||
QStringLiteral("<td class=\"new\">") % log.situationNew.latitudeAsString() % QStringLiteral("</td>") %
|
QStringLiteral("<td class=\"new\">") % situationNew.latitudeAsString() % QStringLiteral("</td>") %
|
||||||
QStringLiteral("<td class=\"cur\">") % log.situationCurrent.latitudeAsString() % QStringLiteral("</td>") %
|
QStringLiteral("<td class=\"cur\">") % log.situationCurrent.latitudeAsString() % QStringLiteral("</td>") %
|
||||||
|
|
||||||
QStringLiteral("<td class=\"old\">") % log.situationOld.longitudeAsString() % QStringLiteral("</td>") %
|
QStringLiteral("<td class=\"old\">") % situationOld.longitudeAsString() % QStringLiteral("</td>") %
|
||||||
QStringLiteral("<td class=\"new\">") % log.situationNew.longitudeAsString() % QStringLiteral("</td>") %
|
QStringLiteral("<td class=\"new\">") % situationNew.longitudeAsString() % QStringLiteral("</td>") %
|
||||||
QStringLiteral("<td class=\"cur\">") % log.situationCurrent.longitudeAsString() % QStringLiteral("</td>");
|
QStringLiteral("<td class=\"cur\">") % log.situationCurrent.longitudeAsString() % QStringLiteral("</td>");
|
||||||
|
|
||||||
tableRows +=
|
tableRows +=
|
||||||
QStringLiteral("<td class=\"old\">") % log.situationOld.getAltitude().valueRoundedWithUnit(ft, 1) % QStringLiteral("</td>") %
|
QStringLiteral("<td class=\"old\">") % situationOld.getAltitude().valueRoundedWithUnit(ft, 1) % QStringLiteral("</td>") %
|
||||||
QStringLiteral("<td class=\"new\">") % log.situationNew.getAltitude().valueRoundedWithUnit(ft, 1) % QStringLiteral("</td>") %
|
QStringLiteral("<td class=\"new\">") % situationNew.getAltitude().valueRoundedWithUnit(ft, 1) % QStringLiteral("</td>") %
|
||||||
QStringLiteral("<td class=\"cur\">") % log.situationCurrent.getAltitude().valueRoundedWithUnit(ft, 1) % QStringLiteral("</td>") %
|
QStringLiteral("<td class=\"cur\">") % log.situationCurrent.getAltitude().valueRoundedWithUnit(ft, 1) % QStringLiteral("</td>") %
|
||||||
|
|
||||||
QStringLiteral("<td class=\"old\">") % log.situationOld.getGroundElevation().valueRoundedWithUnit(ft, 1) % QStringLiteral("</td>") %
|
QStringLiteral("<td class=\"old\">") % situationOld.getGroundElevation().valueRoundedWithUnit(ft, 1) % QStringLiteral("</td>") %
|
||||||
QStringLiteral("<td class=\"new\">") % log.situationNew.getGroundElevation().valueRoundedWithUnit(ft, 1) % QStringLiteral("</td>") %
|
QStringLiteral("<td class=\"new\">") % situationNew.getGroundElevation().valueRoundedWithUnit(ft, 1) % QStringLiteral("</td>") %
|
||||||
QStringLiteral("<td class=\"cur\">") % log.situationCurrent.getGroundElevation().valueRoundedWithUnit(ft, 1) % QStringLiteral("</td>") %
|
QStringLiteral("<td class=\"cur\">") % log.situationCurrent.getGroundElevation().valueRoundedWithUnit(ft, 1) % QStringLiteral("</td>") %
|
||||||
|
|
||||||
QStringLiteral("<td>") % QString::number(log.groundFactor) % QStringLiteral("</td>") %
|
QStringLiteral("<td>") % QString::number(log.groundFactor) % QStringLiteral("</td>") %
|
||||||
QStringLiteral("<td class=\"old\">") % log.situationOld.getOnGroundInfo() % QStringLiteral("</td>") %
|
QStringLiteral("<td class=\"old\">") % situationOld.getOnGroundInfo() % QStringLiteral("</td>") %
|
||||||
QStringLiteral("<td class=\"new\">") % log.situationNew.getOnGroundInfo() % QStringLiteral("</td>") %
|
QStringLiteral("<td class=\"new\">") % situationNew.getOnGroundInfo() % QStringLiteral("</td>") %
|
||||||
QStringLiteral("<td class=\"cur\">") % log.situationCurrent.getOnGroundInfo() % QStringLiteral("</td>");
|
QStringLiteral("<td class=\"cur\">") % log.situationCurrent.getOnGroundInfo() % QStringLiteral("</td>");
|
||||||
|
|
||||||
tableRows +=
|
tableRows +=
|
||||||
@@ -408,10 +410,14 @@ namespace BlackMisc
|
|||||||
bool withCurrentSituation, bool withHints, bool withSetup,
|
bool withCurrentSituation, bool withHints, bool withSetup,
|
||||||
bool withElevation, bool withOtherPositions, bool withDeltaTimes, const QString &separator) const
|
bool withElevation, bool withOtherPositions, bool withDeltaTimes, const QString &separator) const
|
||||||
{
|
{
|
||||||
|
const CAircraftSituation situationOldInterpolation = this->oldestInterpolationSituation();
|
||||||
|
const CAircraftSituation situationNewInterpolation = this->newestInterpolationSituation();
|
||||||
|
|
||||||
return QStringLiteral("CS: ") % callsign.asString() % separator %
|
return QStringLiteral("CS: ") % callsign.asString() % separator %
|
||||||
QStringLiteral("ts: ") % CInterpolationLogger::msSinceEpochToTimeAndTimestamp(tsCurrent) %
|
QStringLiteral("ts: ") % CInterpolationLogger::msSinceEpochToTimeAndTimestamp(tsCurrent) %
|
||||||
QStringLiteral(" type: ") % this->interpolationType() %
|
QStringLiteral(" type: ") % this->interpolationType() %
|
||||||
QStringLiteral(" gnd.fa.: ") % QString::number(groundFactor) %
|
QStringLiteral(" gnd.fa.: ") % QString::number(groundFactor) %
|
||||||
|
QStringLiteral(" #nw.sit.: ") % QString::number(noNetworkSituations) %
|
||||||
(
|
(
|
||||||
withHints ?
|
withHints ?
|
||||||
separator % QStringLiteral("hints: ") % usedHints.toQString(true) :
|
separator % QStringLiteral("hints: ") % usedHints.toQString(true) :
|
||||||
@@ -431,11 +437,14 @@ namespace BlackMisc
|
|||||||
(
|
(
|
||||||
withDeltaTimes ?
|
withDeltaTimes ?
|
||||||
separator %
|
separator %
|
||||||
QStringLiteral("int.time: ") % CInterpolationLogger::msSinceEpochToTimeAndTimestamp(tsCurrent) %
|
QStringLiteral("cur.time: ") % CInterpolationLogger::msSinceEpochToTimeAndTimestamp(tsCurrent) %
|
||||||
|
QStringLiteral(" int.time: ") % CInterpolationLogger::msSinceEpochToTimeAndTimestamp(tsInterpolated) %
|
||||||
|
QStringLiteral(" dt.cur.int.: ") % QString::number(deltaCurrentToInterpolatedTime()) % QStringLiteral("ms") %
|
||||||
QStringLiteral(" sample dt: ") % QString::number(deltaSampleTimesMs) % QStringLiteral("ms") %
|
QStringLiteral(" sample dt: ") % QString::number(deltaSampleTimesMs) % QStringLiteral("ms") %
|
||||||
QStringLiteral(" fr.[0-1]: ") % QString::number(simulationTimeFraction) %
|
QStringLiteral(" fr.[0-1]: ") % QString::number(simulationTimeFraction) %
|
||||||
QStringLiteral(" old pos.: ") % situationOld.getTimestampAndOffset(true) %
|
QStringLiteral(" old int.pos.: ") % situationOldInterpolation.getTimestampAndOffset(true) %
|
||||||
QStringLiteral(" new pos.: ") % situationNew.getTimestampAndOffset(true) :
|
QStringLiteral(" new int.pos.: ") % situationNewInterpolation.getTimestampAndOffset(true) %
|
||||||
|
QStringLiteral(" #int.pos.: ") % QString::number(interpolationSituations.size()) :
|
||||||
QStringLiteral("")
|
QStringLiteral("")
|
||||||
) %
|
) %
|
||||||
(
|
(
|
||||||
@@ -447,9 +456,9 @@ namespace BlackMisc
|
|||||||
(
|
(
|
||||||
withOtherPositions ?
|
withOtherPositions ?
|
||||||
separator %
|
separator %
|
||||||
QStringLiteral("old: ") % situationOld.toQString(true) %
|
QStringLiteral("old: ") % situationOldInterpolation.toQString(true) %
|
||||||
separator %
|
separator %
|
||||||
QStringLiteral("new: ") % situationNew.toQString(true) :
|
QStringLiteral("new: ") % situationNewInterpolation.toQString(true) :
|
||||||
QStringLiteral("")
|
QStringLiteral("")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
#include "interpolationhints.h"
|
#include "interpolationhints.h"
|
||||||
#include "blackmisc/simulation/remoteaircraftprovider.h"
|
#include "blackmisc/simulation/remoteaircraftprovider.h"
|
||||||
#include "blackmisc/aviation/aircraftpartslist.h"
|
#include "blackmisc/aviation/aircraftpartslist.h"
|
||||||
#include "blackmisc/aviation/aircraftsituation.h"
|
#include "blackmisc/aviation/aircraftsituationlist.h"
|
||||||
#include "blackmisc/aviation/aircraftpartslist.h"
|
#include "blackmisc/aviation/aircraftpartslist.h"
|
||||||
#include "blackmisc/logcategorylist.h"
|
#include "blackmisc/logcategorylist.h"
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
@@ -52,54 +52,6 @@ namespace BlackMisc
|
|||||||
//! Get the log directory
|
//! Get the log directory
|
||||||
static QString getLogDirectory();
|
static QString getLogDirectory();
|
||||||
|
|
||||||
//! Log entry for situation interpolation
|
|
||||||
struct BLACKMISC_EXPORT SituationLog
|
|
||||||
{
|
|
||||||
QChar interpolator; //!< what interpolator is used
|
|
||||||
qint64 tsCurrent = -1; //!< current timestamp
|
|
||||||
qint64 tsInterpolated = -1; //!< timestamp interpolated
|
|
||||||
double groundFactor = -1; //!< current ground factor
|
|
||||||
double vtolAircraft = false; //!< VTOL aircraft
|
|
||||||
double simulationTimeFraction = -1; //!< time fraction, expected 0..1
|
|
||||||
double deltaSampleTimesMs = -1; //!< delta time between samples (i.e. 2 situations)
|
|
||||||
bool useParts = false; //!< supporting aircraft parts
|
|
||||||
int noTransferredElevations = 0; //!< transferred elevation to n situations
|
|
||||||
Aviation::CCallsign callsign; //!< current callsign
|
|
||||||
Aviation::CAircraftParts parts; //!< corresponding parts used in interpolator
|
|
||||||
Aviation::CAircraftSituation situationOld; //!< old situation
|
|
||||||
Aviation::CAircraftSituation situationNew; //!< new situation
|
|
||||||
Aviation::CAircraftSituation situationCurrent; //!< interpolated situation
|
|
||||||
PhysicalQuantities::CLength cgAboveGround; //!< center of gravity
|
|
||||||
CInterpolationAndRenderingSetup usedSetup; //!< used setup
|
|
||||||
CInterpolationHints usedHints; //!< hints
|
|
||||||
|
|
||||||
//! Delta time between interpolation and current time
|
|
||||||
double deltaCurrentToInterpolatedTime() const
|
|
||||||
{
|
|
||||||
return static_cast<double>(tsCurrent - tsInterpolated);
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Full name of interpolator
|
|
||||||
const QString &interpolationType() const;
|
|
||||||
|
|
||||||
//! To string
|
|
||||||
QString toQString(
|
|
||||||
bool withCurrentSituation, bool withHints, bool withSetup, bool withElevation,
|
|
||||||
bool withOtherPositions, bool withDeltaTimes, const QString &separator = {" "}) const;
|
|
||||||
};
|
|
||||||
|
|
||||||
//! Log entry for parts interpolation
|
|
||||||
struct BLACKMISC_EXPORT PartsLog
|
|
||||||
{
|
|
||||||
qint64 tsCurrent = -1; //!< current timestamp
|
|
||||||
bool empty = false; //!< empty parts?
|
|
||||||
Aviation::CCallsign callsign; //!< current callsign
|
|
||||||
Aviation::CAircraftParts parts; //!< parts to be logged
|
|
||||||
|
|
||||||
//! To string
|
|
||||||
QString toQString(const QString &separator = {" "}) const;
|
|
||||||
};
|
|
||||||
|
|
||||||
//! Log current interpolation cycle, only stores in memory, for performance reasons
|
//! Log current interpolation cycle, only stores in memory, for performance reasons
|
||||||
//! \remark const to allow const interpolator functions
|
//! \remark const to allow const interpolator functions
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
|
|||||||
@@ -79,6 +79,9 @@ namespace BlackMisc
|
|||||||
//! \remark parts logging has a \c bool \c log flag
|
//! \remark parts logging has a \c bool \c log flag
|
||||||
void attachLogger(CInterpolationLogger *logger) { m_logger = logger; }
|
void attachLogger(CInterpolationLogger *logger) { m_logger = logger; }
|
||||||
|
|
||||||
|
//! Is logger attached
|
||||||
|
bool hasAttachedLogger() const { return m_logger; }
|
||||||
|
|
||||||
//! Get an interpolator info string (for debug info)
|
//! Get an interpolator info string (for debug info)
|
||||||
QString getInterpolatorInfo() const;
|
QString getInterpolatorInfo() const;
|
||||||
|
|
||||||
|
|||||||
@@ -122,8 +122,6 @@ namespace BlackMisc
|
|||||||
const double sampleDeltaTimeMs = newSituation.getAdjustedMSecsSinceEpoch() - oldSituation.getAdjustedMSecsSinceEpoch();
|
const double sampleDeltaTimeMs = newSituation.getAdjustedMSecsSinceEpoch() - oldSituation.getAdjustedMSecsSinceEpoch();
|
||||||
Q_ASSERT_X(sampleDeltaTimeMs >= 0, Q_FUNC_INFO, "Negative delta time");
|
Q_ASSERT_X(sampleDeltaTimeMs >= 0, Q_FUNC_INFO, "Negative delta time");
|
||||||
log.interpolator = 'l';
|
log.interpolator = 'l';
|
||||||
log.tsCurrent = currentTimeMsSinceEpoc;
|
|
||||||
log.deltaSampleTimesMs = sampleDeltaTimeMs;
|
|
||||||
|
|
||||||
// Fraction of the deltaTime, ideally [0.0 - 1.0]
|
// Fraction of the deltaTime, ideally [0.0 - 1.0]
|
||||||
// < 0 should not happen due to the split, > 1 can happen if new values are delayed beyond split time
|
// < 0 should not happen due to the split, > 1 can happen if new values are delayed beyond split time
|
||||||
@@ -132,16 +130,23 @@ namespace BlackMisc
|
|||||||
const double distanceToSplitTimeMs = newSituation.getAdjustedMSecsSinceEpoch() - currentTimeMsSinceEpoc;
|
const double distanceToSplitTimeMs = newSituation.getAdjustedMSecsSinceEpoch() - currentTimeMsSinceEpoc;
|
||||||
const double simulationTimeFraction = qMax(1.0 - (distanceToSplitTimeMs / sampleDeltaTimeMs), 0.0);
|
const double simulationTimeFraction = qMax(1.0 - (distanceToSplitTimeMs / sampleDeltaTimeMs), 0.0);
|
||||||
const double deltaTimeFractionMs = sampleDeltaTimeMs * simulationTimeFraction;
|
const double deltaTimeFractionMs = sampleDeltaTimeMs * simulationTimeFraction;
|
||||||
log.simulationTimeFraction = simulationTimeFraction;
|
|
||||||
log.deltaSampleTimesMs = sampleDeltaTimeMs;
|
|
||||||
|
|
||||||
currentSituation.setTimeOffsetMs(oldSituation.getTimeOffsetMs() + (newSituation.getTimeOffsetMs() - oldSituation.getTimeOffsetMs()) * simulationTimeFraction);
|
currentSituation.setTimeOffsetMs(oldSituation.getTimeOffsetMs() + (newSituation.getTimeOffsetMs() - oldSituation.getTimeOffsetMs()) * simulationTimeFraction);
|
||||||
currentSituation.setMSecsSinceEpoch(oldSituation.getMSecsSinceEpoch() + deltaTimeFractionMs);
|
currentSituation.setMSecsSinceEpoch(oldSituation.getMSecsSinceEpoch() + deltaTimeFractionMs);
|
||||||
status.setInterpolatedAndCheckSituation(true, currentSituation);
|
status.setInterpolatedAndCheckSituation(true, currentSituation);
|
||||||
log.tsInterpolated = currentSituation.getAdjustedMSecsSinceEpoch();
|
|
||||||
|
|
||||||
log.situationOld = oldSituation;
|
if (this->hasAttachedLogger())
|
||||||
log.situationNew = newSituation;
|
{
|
||||||
|
log.tsCurrent = currentTimeMsSinceEpoc;
|
||||||
|
log.deltaSampleTimesMs = sampleDeltaTimeMs;
|
||||||
|
log.simulationTimeFraction = simulationTimeFraction;
|
||||||
|
log.deltaSampleTimesMs = sampleDeltaTimeMs;
|
||||||
|
log.tsInterpolated = interpolatedTime;
|
||||||
|
log.interpolationSituations.clear();
|
||||||
|
log.interpolationSituations.push_back(newSituation); // newest at front
|
||||||
|
log.interpolationSituations.push_back(oldSituation); // oldest at back
|
||||||
|
}
|
||||||
|
|
||||||
return { oldSituation, newSituation, simulationTimeFraction };
|
return { oldSituation, newSituation, simulationTimeFraction };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ namespace BlackMisc
|
|||||||
return m_interpolant;
|
return m_interpolant;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::array<CAircraftSituation, 3> s {{ *(situationsOlder.begin() + 1), *situationsOlder.begin(), *(situationsNewer.end() - 1) }};
|
m_s = std::array<CAircraftSituation, 3> {{ *(situationsOlder.begin() + 1), *situationsOlder.begin(), *(situationsNewer.end() - 1) }};
|
||||||
|
|
||||||
// - altitude unit must be the same for all three, but the unit itself does not matter
|
// - altitude unit must be the same for all three, but the unit itself does not matter
|
||||||
// - ground elevantion here normally is not available
|
// - ground elevantion here normally is not available
|
||||||
@@ -130,22 +130,22 @@ namespace BlackMisc
|
|||||||
if (!hints.getElevationPlane().isNull())
|
if (!hints.getElevationPlane().isNull())
|
||||||
{
|
{
|
||||||
// do not override existing values
|
// do not override existing values
|
||||||
s[0].setGroundElevationChecked(hints.getElevationPlane());
|
m_s[0].setGroundElevationChecked(hints.getElevationPlane());
|
||||||
s[1].setGroundElevationChecked(hints.getElevationPlane());
|
m_s[1].setGroundElevationChecked(hints.getElevationPlane());
|
||||||
s[2].setGroundElevationChecked(hints.getElevationPlane());
|
m_s[2].setGroundElevationChecked(hints.getElevationPlane());
|
||||||
}
|
}
|
||||||
|
|
||||||
const double a0 = s[0].getCorrectedAltitude(hints.getCGAboveGround()).value();
|
const double a0 = m_s[0].getCorrectedAltitude(hints.getCGAboveGround()).value();
|
||||||
const double a1 = s[1].getCorrectedAltitude(hints.getCGAboveGround()).value();
|
const double a1 = m_s[1].getCorrectedAltitude(hints.getCGAboveGround()).value();
|
||||||
const double a2 = s[2].getCorrectedAltitude(hints.getCGAboveGround()).value();
|
const double a2 = m_s[2].getCorrectedAltitude(hints.getCGAboveGround()).value();
|
||||||
|
|
||||||
const std::array<std::array<double, 3>, 3> normals {{ s[0].getPosition().normalVectorDouble(), s[1].getPosition().normalVectorDouble(), s[2].getPosition().normalVectorDouble() }};
|
const std::array<std::array<double, 3>, 3> normals {{ m_s[0].getPosition().normalVectorDouble(), m_s[1].getPosition().normalVectorDouble(), m_s[2].getPosition().normalVectorDouble() }};
|
||||||
PosArray pa;
|
PosArray pa;
|
||||||
pa.x = {{ normals[0][0], normals[1][0], normals[2][0] }};
|
pa.x = {{ normals[0][0], normals[1][0], normals[2][0] }};
|
||||||
pa.y = {{ normals[0][1], normals[1][1], normals[2][1] }};
|
pa.y = {{ normals[0][1], normals[1][1], normals[2][1] }};
|
||||||
pa.z = {{ normals[0][2], normals[1][2], normals[2][2] }};
|
pa.z = {{ normals[0][2], normals[1][2], normals[2][2] }};
|
||||||
pa.a = {{ a0, a1, a2 }};
|
pa.a = {{ a0, a1, a2 }};
|
||||||
pa.t = {{ static_cast<double>(s[0].getAdjustedMSecsSinceEpoch()), static_cast<double>(s[1].getAdjustedMSecsSinceEpoch()), static_cast<double>(s[2].getAdjustedMSecsSinceEpoch()) }};
|
pa.t = {{ static_cast<double>(m_s[0].getAdjustedMSecsSinceEpoch()), static_cast<double>(m_s[1].getAdjustedMSecsSinceEpoch()), static_cast<double>(m_s[2].getAdjustedMSecsSinceEpoch()) }};
|
||||||
|
|
||||||
pa.dx = getDerivatives(pa.t, pa.x);
|
pa.dx = getDerivatives(pa.t, pa.x);
|
||||||
pa.dy = getDerivatives(pa.t, pa.y);
|
pa.dy = getDerivatives(pa.t, pa.y);
|
||||||
@@ -160,12 +160,17 @@ namespace BlackMisc
|
|||||||
const double dt1 = static_cast<double>(currentTimeMsSinceEpoc - m_prevSampleTime);
|
const double dt1 = static_cast<double>(currentTimeMsSinceEpoc - m_prevSampleTime);
|
||||||
const double dt2 = static_cast<double>(m_nextSampleTime - m_prevSampleTime);
|
const double dt2 = static_cast<double>(m_nextSampleTime - m_prevSampleTime);
|
||||||
const double timeFraction = dt1 / dt2;
|
const double timeFraction = dt1 / dt2;
|
||||||
|
|
||||||
|
if (this->hasAttachedLogger())
|
||||||
|
{
|
||||||
|
log.interpolationSituations.push_back(m_s[0]);
|
||||||
|
log.interpolationSituations.push_back(m_s[1]);
|
||||||
|
log.interpolationSituations.push_back(m_s[2]); // latest at end
|
||||||
log.interpolator = 's';
|
log.interpolator = 's';
|
||||||
log.situationOld = m_interpolant.pbh().getOldSituation();
|
|
||||||
log.situationNew = m_interpolant.pbh().getNewSituation();
|
|
||||||
log.deltaSampleTimesMs = dt2;
|
log.deltaSampleTimesMs = dt2;
|
||||||
log.simulationTimeFraction = timeFraction;
|
log.simulationTimeFraction = timeFraction;
|
||||||
log.tsInterpolated = log.situationNew.getMSecsSinceEpoch(); // without offset
|
log.tsInterpolated = log.newestInterpolationSituation().getMSecsSinceEpoch(); // without offset
|
||||||
|
}
|
||||||
|
|
||||||
status.setInterpolated(true);
|
status.setInterpolated(true);
|
||||||
m_interpolant.setTimes(currentTimeMsSinceEpoc, timeFraction);
|
m_interpolant.setTimes(currentTimeMsSinceEpoc, timeFraction);
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ namespace BlackMisc
|
|||||||
private:
|
private:
|
||||||
qint64 m_prevSampleTime = 0;
|
qint64 m_prevSampleTime = 0;
|
||||||
qint64 m_nextSampleTime = 0;
|
qint64 m_nextSampleTime = 0;
|
||||||
|
std::array<Aviation::CAircraftSituation, 3> m_s;
|
||||||
Interpolant m_interpolant;
|
Interpolant m_interpolant;
|
||||||
};
|
};
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
Reference in New Issue
Block a user