mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 17:35:34 +08:00
Ref T171, interpolator / interpolation logger formatting
This commit is contained in:
@@ -110,14 +110,9 @@ namespace BlackMisc
|
|||||||
|
|
||||||
CStatusMessage CInterpolationLogger::logStatusFileWriting(bool success, const QString &fileName)
|
CStatusMessage CInterpolationLogger::logStatusFileWriting(bool success, const QString &fileName)
|
||||||
{
|
{
|
||||||
if (success)
|
return success ?
|
||||||
{
|
CStatusMessage(static_cast<CInterpolationLogger *>(nullptr)).info("Written log file '%1'") << fileName :
|
||||||
return CStatusMessage(static_cast<CInterpolationLogger *>(nullptr)).info("Written log file '%1'") << fileName;
|
CStatusMessage(static_cast<CInterpolationLogger *>(nullptr)).error("Failed to write log file '%1'") << fileName;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return CStatusMessage(static_cast<CInterpolationLogger *>(nullptr)).error("Failed to write log file '%1'") << fileName;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInterpolationLogger::logInterpolation(const CInterpolationLogger::SituationLog &log)
|
void CInterpolationLogger::logInterpolation(const CInterpolationLogger::SituationLog &log)
|
||||||
|
|||||||
@@ -58,15 +58,15 @@ namespace BlackMisc
|
|||||||
double groundFactor = -1; //!< current ground factor
|
double groundFactor = -1; //!< current ground factor
|
||||||
double vtolAircraft = false; //!< VTOL aircraft
|
double vtolAircraft = false; //!< VTOL aircraft
|
||||||
double deltaTimeMs = 0; //!< delta time to last situation
|
double deltaTimeMs = 0; //!< delta time to last situation
|
||||||
double simulationTimeFraction = -1; //!< time fraction, normally 0..1
|
double simulationTimeFraction = -1; //!< time fraction, normally 0..1
|
||||||
double deltaTimeFractionMs = -1; //!< delta time fraction
|
double deltaTimeFractionMs = -1; //!< delta time fraction
|
||||||
bool useParts = false; //!< supporting aircraft parts
|
bool useParts = false; //!< supporting aircraft parts
|
||||||
BlackMisc::Aviation::CCallsign callsign; //!< current callsign
|
Aviation::CCallsign callsign; //!< current callsign
|
||||||
BlackMisc::Aviation::CAircraftParts parts; //!< corresponding parts used in interpolator
|
Aviation::CAircraftParts parts; //!< corresponding parts used in interpolator
|
||||||
BlackMisc::Aviation::CAircraftSituation oldSituation; //!< old situation
|
Aviation::CAircraftSituation oldSituation; //!< old situation
|
||||||
BlackMisc::Aviation::CAircraftSituation newSituation; //!< new situation
|
Aviation::CAircraftSituation newSituation; //!< new situation
|
||||||
BlackMisc::Aviation::CAircraftSituation currentSituation; //!< interpolated situation
|
Aviation::CAircraftSituation currentSituation; //!< interpolated situation
|
||||||
BlackMisc::PhysicalQuantities::CLength cgAboveGround; //!< center of gravity
|
PhysicalQuantities::CLength cgAboveGround; //!< center of gravity
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Log entry for parts interpolation
|
//! Log entry for parts interpolation
|
||||||
@@ -74,8 +74,8 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
qint64 timestamp = -1; //!< current timestamp
|
qint64 timestamp = -1; //!< current timestamp
|
||||||
bool empty = false; //!< empty parts?
|
bool empty = false; //!< empty parts?
|
||||||
BlackMisc::Aviation::CCallsign callsign; //!< current callsign
|
Aviation::CCallsign callsign; //!< current callsign
|
||||||
BlackMisc::Aviation::CAircraftParts parts; //!< parts to be logged
|
Aviation::CAircraftParts parts; //!< parts to be logged
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Log current interpolation cycle, only stores in memory, for performance reasons
|
//! Log current interpolation cycle, only stores in memory, for performance reasons
|
||||||
@@ -107,7 +107,7 @@ namespace BlackMisc
|
|||||||
//! Create readable time
|
//! Create readable time
|
||||||
static QString msSinceEpochToTime(qint64 t1, qint64 t2, qint64 t3 = -1);
|
static QString msSinceEpochToTime(qint64 t1, qint64 t2, qint64 t3 = -1);
|
||||||
|
|
||||||
mutable QReadWriteLock m_lockLogs; //!< lock logging
|
mutable QReadWriteLock m_lockLogs; //!< lock logging
|
||||||
QList<PartsLog> m_partsLogs; //!< logs of parts
|
QList<PartsLog> m_partsLogs; //!< logs of parts
|
||||||
QList<SituationLog> m_situationLogs; //!< logs of interpolation
|
QList<SituationLog> m_situationLogs; //!< logs of interpolation
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -45,8 +45,10 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename Derived>
|
template <typename Derived>
|
||||||
CAircraftSituation CInterpolator<Derived>::getInterpolatedSituation(qint64 currentTimeMsSinceEpoc,
|
CAircraftSituation CInterpolator<Derived>::getInterpolatedSituation(
|
||||||
const CInterpolationAndRenderingSetup &setup, const CInterpolationHints &hints, CInterpolationStatus &status)
|
qint64 currentTimeMsSinceEpoc,
|
||||||
|
const CInterpolationAndRenderingSetup &setup, const CInterpolationHints &hints,
|
||||||
|
CInterpolationStatus &status)
|
||||||
{
|
{
|
||||||
status.reset();
|
status.reset();
|
||||||
CInterpolationLogger::SituationLog log;
|
CInterpolationLogger::SituationLog log;
|
||||||
|
|||||||
@@ -74,6 +74,8 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! Attach an observer to read the interpolator's state for debugging
|
//! Attach an observer to read the interpolator's state for debugging
|
||||||
|
//! \remark situation logging requires CInterpolationHints::isLoggingInterpolation to be \c true
|
||||||
|
//! \remark parts logging has a \c bool \c log flag
|
||||||
void attachLogger(CInterpolationLogger *logger) { m_logger = logger; }
|
void attachLogger(CInterpolationLogger *logger) { m_logger = logger; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -26,12 +26,9 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
switch (m_mode)
|
switch (m_mode)
|
||||||
{
|
{
|
||||||
case ModeLinear:
|
case ModeLinear: return m_linear.getInterpolatedSituation(currentTimeSinceEpoc, setup, hints, status);
|
||||||
return m_linear.getInterpolatedSituation(currentTimeSinceEpoc, setup, hints, status);
|
case ModeSpline: return m_spline.getInterpolatedSituation(currentTimeSinceEpoc, setup, hints, status);
|
||||||
case ModeSpline:
|
default: break;
|
||||||
return m_spline.getInterpolatedSituation(currentTimeSinceEpoc, setup, hints, status);
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@@ -41,12 +38,9 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
switch (m_mode)
|
switch (m_mode)
|
||||||
{
|
{
|
||||||
case ModeLinear:
|
case ModeLinear: return m_linear.getInterpolatedParts(currentTimeSinceEpoc, setup, partsStatus, log);
|
||||||
return m_linear.getInterpolatedParts(currentTimeSinceEpoc, setup, partsStatus, log);
|
case ModeSpline: return m_spline.getInterpolatedParts(currentTimeSinceEpoc, setup, partsStatus, log);
|
||||||
case ModeSpline:
|
default: break;
|
||||||
return m_spline.getInterpolatedParts(currentTimeSinceEpoc, setup, partsStatus, log);
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,11 +32,13 @@ namespace BlackMisc
|
|||||||
|
|
||||||
//! \copydoc CInterpolator::getInterpolatedSituation
|
//! \copydoc CInterpolator::getInterpolatedSituation
|
||||||
BlackMisc::Aviation::CAircraftSituation getInterpolatedSituation(
|
BlackMisc::Aviation::CAircraftSituation getInterpolatedSituation(
|
||||||
qint64 currentTimeSinceEpoc, const CInterpolationAndRenderingSetup &setup, const CInterpolationHints &hints, CInterpolationStatus &status);
|
qint64 currentTimeSinceEpoc, const CInterpolationAndRenderingSetup &setup,
|
||||||
|
const CInterpolationHints &hints, CInterpolationStatus &status);
|
||||||
|
|
||||||
//! \copydoc CInterpolator::getInterpolatedParts
|
//! \copydoc CInterpolator::getInterpolatedParts
|
||||||
BlackMisc::Aviation::CAircraftParts getInterpolatedParts(
|
BlackMisc::Aviation::CAircraftParts getInterpolatedParts(
|
||||||
qint64 currentTimeSinceEpoc, const CInterpolationAndRenderingSetup &setup, CPartsStatus &partsStatus, bool log = false);
|
qint64 currentTimeSinceEpoc, const CInterpolationAndRenderingSetup &setup,
|
||||||
|
CPartsStatus &partsStatus, bool log = false);
|
||||||
|
|
||||||
//! \copydoc CInterpolator::addAircraftSituation
|
//! \copydoc CInterpolator::addAircraftSituation
|
||||||
void addAircraftSituation(const BlackMisc::Aviation::CAircraftSituation &situation);
|
void addAircraftSituation(const BlackMisc::Aviation::CAircraftSituation &situation);
|
||||||
|
|||||||
Reference in New Issue
Block a user