mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-04 08:55:43 +08:00
Ref T171, interpolator log
* set interpolator type spline or linear * set some detail values for spline log * removed unused variable
This commit is contained in:
@@ -154,7 +154,8 @@ namespace BlackMisc
|
|||||||
if (logs.isEmpty()) { return {}; }
|
if (logs.isEmpty()) { return {}; }
|
||||||
const QString tableHeader =
|
const QString tableHeader =
|
||||||
QLatin1String("<thead><tr>") %
|
QLatin1String("<thead><tr>") %
|
||||||
QLatin1String("<th title=\"changed situation\">cs.</th><th>CS</th><th>VTOL</th><th>timestamp</th><th>since</th>") %
|
QLatin1String("<th title=\"changed situation\">cs.</th><th>Int</th>") %
|
||||||
|
QLatin1String("<th>CS</th><th>VTOL</th><th>timestamp</th><th>since</th>") %
|
||||||
QLatin1String("<th>ts old</th><th>ts new</th><th>ts cur</th>") %
|
QLatin1String("<th>ts old</th><th>ts new</th><th>ts cur</th>") %
|
||||||
QLatin1String("<th>Δt</th><th>Δt fr.</th><th>fraction</th>") %
|
QLatin1String("<th>Δt</th><th>Δt fr.</th><th>fraction</th>") %
|
||||||
QLatin1String("<th>lat.old</th><th>lat.new</th><th>lat.cur</th>") %
|
QLatin1String("<th>lat.old</th><th>lat.new</th><th>lat.cur</th>") %
|
||||||
@@ -184,6 +185,7 @@ namespace BlackMisc
|
|||||||
tableRows +=
|
tableRows +=
|
||||||
QLatin1String("<tr>") %
|
QLatin1String("<tr>") %
|
||||||
(changedNewPosition ? QLatin1String("<td class=\"changed\">*</td>") : QLatin1String("<td></td>")) %
|
(changedNewPosition ? QLatin1String("<td class=\"changed\">*</td>") : QLatin1String("<td></td>")) %
|
||||||
|
QLatin1String("<td>") % log.interpolator % QLatin1String("</td>") %
|
||||||
QLatin1String("<td>") % log.callsign.asString() % QLatin1String("</td>") %
|
QLatin1String("<td>") % log.callsign.asString() % QLatin1String("</td>") %
|
||||||
QLatin1String("<td>") % boolToYesNo(log.vtolAircraft) % QLatin1String("</td>") %
|
QLatin1String("<td>") % boolToYesNo(log.vtolAircraft) % QLatin1String("</td>") %
|
||||||
QLatin1String("<td>") % msSinceEpochToTime(log.timestamp) % QLatin1String("</td>") %
|
QLatin1String("<td>") % msSinceEpochToTime(log.timestamp) % QLatin1String("</td>") %
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ namespace BlackMisc
|
|||||||
//! Log entry for situation interpolation
|
//! Log entry for situation interpolation
|
||||||
struct SituationLog
|
struct SituationLog
|
||||||
{
|
{
|
||||||
|
QChar interpolator; //!< what interpolator is used
|
||||||
qint64 timestamp = -1; //!< current timestamp
|
qint64 timestamp = -1; //!< current timestamp
|
||||||
double groundFactor = -1; //!< current ground factor
|
double groundFactor = -1; //!< current ground factor
|
||||||
double vtolAircraft = false; //!< VTOL aircraft
|
double vtolAircraft = false; //!< VTOL aircraft
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace BlackMisc
|
|||||||
namespace Simulation
|
namespace Simulation
|
||||||
{
|
{
|
||||||
CInterpolatorLinear::Interpolant CInterpolatorLinear::getInterpolant(qint64 currentTimeMsSinceEpoc,
|
CInterpolatorLinear::Interpolant CInterpolatorLinear::getInterpolant(qint64 currentTimeMsSinceEpoc,
|
||||||
const CInterpolationAndRenderingSetup &setup, const CInterpolationHints &hints, CInterpolationStatus &status, CInterpolationLogger::SituationLog &log) const
|
const CInterpolationAndRenderingSetup &setup, const CInterpolationHints &hints, CInterpolationStatus &status, CInterpolationLogger::SituationLog &log) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(setup);
|
Q_UNUSED(setup);
|
||||||
Q_UNUSED(hints);
|
Q_UNUSED(hints);
|
||||||
@@ -94,11 +94,11 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
|
|
||||||
CAircraftSituation currentSituation(oldSituation); // also sets ground elevation if available
|
CAircraftSituation currentSituation(oldSituation); // also sets ground elevation if available
|
||||||
CCoordinateGeodetic currentPosition;
|
|
||||||
|
|
||||||
// Time between start and end packet
|
// Time between start and end packet
|
||||||
const double deltaTimeMs = newSituation.getAdjustedMSecsSinceEpoch() - oldSituation.getAdjustedMSecsSinceEpoch();
|
const double deltaTimeMs = newSituation.getAdjustedMSecsSinceEpoch() - oldSituation.getAdjustedMSecsSinceEpoch();
|
||||||
Q_ASSERT_X(deltaTimeMs >= 0, Q_FUNC_INFO, "Negative delta time");
|
Q_ASSERT_X(deltaTimeMs >= 0, Q_FUNC_INFO, "Negative delta time");
|
||||||
|
log.interpolator = 'l';
|
||||||
log.deltaTimeMs = deltaTimeMs;
|
log.deltaTimeMs = deltaTimeMs;
|
||||||
|
|
||||||
// Fraction of the deltaTime, ideally [0.0 - 1.0]
|
// Fraction of the deltaTime, ideally [0.0 - 1.0]
|
||||||
|
|||||||
@@ -128,12 +128,19 @@ namespace BlackMisc
|
|||||||
m_altitudeUnit = situationsOlder.begin()->getAltitude().getUnit();
|
m_altitudeUnit = situationsOlder.begin()->getAltitude().getUnit();
|
||||||
m_pbh = { *situationsOlder.begin(), *(situationsNewer.end() - 1) };
|
m_pbh = { *situationsOlder.begin(), *(situationsNewer.end() - 1) };
|
||||||
}
|
}
|
||||||
|
log.interpolator = 's';
|
||||||
log.oldSituation = m_pbh.getOldSituation();
|
log.oldSituation = m_pbh.getOldSituation();
|
||||||
log.newSituation = m_pbh.getNewSituation();
|
log.newSituation = m_pbh.getNewSituation();
|
||||||
|
|
||||||
status.setInterpolationSucceeded(true);
|
status.setInterpolationSucceeded(true);
|
||||||
status.setChangedPosition(true);
|
status.setChangedPosition(true);
|
||||||
m_pbh.setTimeFraction(static_cast<double>(currentTimeMsSinceEpoc - m_prevSampleTime) / static_cast<double>(m_nextSampleTime - m_prevSampleTime));
|
const double dt1 = static_cast<double>(currentTimeMsSinceEpoc - m_prevSampleTime);
|
||||||
|
const double dt2 = static_cast<double>(m_nextSampleTime - m_prevSampleTime);
|
||||||
|
const double timeFraction = dt1 / dt2;
|
||||||
|
log.deltaTimeMs = dt1;
|
||||||
|
log.deltaTimeFractionMs = dt2;
|
||||||
|
log.simulationTimeFraction = timeFraction;
|
||||||
|
m_pbh.setTimeFraction(timeFraction);
|
||||||
|
|
||||||
return { *this, currentTimeMsSinceEpoc };
|
return { *this, currentTimeMsSinceEpoc };
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user