mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-27 11:05:44 +08:00
fixup! Add velocity extrapolator
This commit is contained in:
@@ -549,7 +549,6 @@ namespace BlackCore
|
|||||||
m_flightPlanCache.clear();
|
m_flightPlanCache.clear();
|
||||||
m_readiness.clear();
|
m_readiness.clear();
|
||||||
m_queryPilot.clear();
|
m_queryPilot.clear();
|
||||||
m_fullSituations.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAirspaceMonitor::removeFromAircraftCachesAndLogs(const CCallsign &callsign)
|
void CAirspaceMonitor::removeFromAircraftCachesAndLogs(const CCallsign &callsign)
|
||||||
@@ -557,7 +556,6 @@ namespace BlackCore
|
|||||||
if (callsign.isEmpty()) { return; }
|
if (callsign.isEmpty()) { return; }
|
||||||
m_flightPlanCache.remove(callsign);
|
m_flightPlanCache.remove(callsign);
|
||||||
m_readiness.remove(callsign);
|
m_readiness.remove(callsign);
|
||||||
m_fullSituations.remove(callsign);
|
|
||||||
this->removeReverseLookupMessages(callsign);
|
this->removeReverseLookupMessages(callsign);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1272,16 +1270,11 @@ namespace BlackCore
|
|||||||
// update client info
|
// update client info
|
||||||
this->autoAdjustCientGndCapability(situation);
|
this->autoAdjustCientGndCapability(situation);
|
||||||
|
|
||||||
Q_ASSERT_X(!situation.hasVelocity(), Q_FUNC_INFO, "Velocity of aircraft updates must be invalid");
|
Q_ASSERT_X(!situation.hasVelocity(), Q_FUNC_INFO, "Velocity of full aircraft updates must be invalid");
|
||||||
|
|
||||||
// store situation history
|
// store situation history
|
||||||
this->storeAircraftSituation(situation); // updates situation
|
this->storeAircraftSituation(situation); // updates situation
|
||||||
|
|
||||||
// The packet is only stored above, if previously no velocity packet was added.
|
|
||||||
// To transfer data from the @ update to velocity updates, store this situation separatly
|
|
||||||
// TODO: Not needed anymore if all packets would be added to the history
|
|
||||||
m_fullSituations[callsign] = situation;
|
|
||||||
|
|
||||||
// in case we only have
|
// in case we only have
|
||||||
if (!existsInRange && validMaxRange)
|
if (!existsInRange && validMaxRange)
|
||||||
{
|
{
|
||||||
@@ -1381,28 +1374,9 @@ namespace BlackCore
|
|||||||
// hence set the last known value from last full update or last visual update.
|
// hence set the last known value from last full update or last visual update.
|
||||||
// If there is no full position available yet, throw this visual position away.
|
// If there is no full position available yet, throw this visual position away.
|
||||||
CAircraftSituation visualSituation(situation);
|
CAircraftSituation visualSituation(situation);
|
||||||
CAircraftSituation lastSituation{};
|
|
||||||
auto lastDataIt = m_fullSituations.find(callsign);
|
|
||||||
CAircraftSituationList history = this->remoteAircraftSituations(callsign);
|
CAircraftSituationList history = this->remoteAircraftSituations(callsign);
|
||||||
if (lastDataIt != m_fullSituations.end())
|
if (history.empty()) { return; } // we need one full situation at least
|
||||||
{
|
const CAircraftSituation lastSituation = history.latestObject();
|
||||||
// New full update in last data.
|
|
||||||
lastSituation = *lastDataIt;
|
|
||||||
m_fullSituations.erase(lastDataIt);
|
|
||||||
}
|
|
||||||
else if (!history.empty())
|
|
||||||
{
|
|
||||||
// Use full update info from last position/visual update
|
|
||||||
lastSituation = history.latestObject();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// No full update received yet. Should never happen because the aircraft must be in range (PilotUpdate received)
|
|
||||||
// before even getting here.
|
|
||||||
Q_ASSERT_X(false, Q_FUNC_INFO, "No information about this aircraft yet");
|
|
||||||
// Throw away visual update
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// changed position, continue and copy values
|
// changed position, continue and copy values
|
||||||
visualSituation.setCurrentUtcTime();
|
visualSituation.setCurrentUtcTime();
|
||||||
|
|||||||
@@ -289,7 +289,6 @@ namespace BlackCore
|
|||||||
BlackMisc::CSettingReadOnly<BlackMisc::Simulation::Settings::TModelMatching> m_matchingSettings { this }; //!< settings
|
BlackMisc::CSettingReadOnly<BlackMisc::Simulation::Settings::TModelMatching> m_matchingSettings { this }; //!< settings
|
||||||
QQueue<BlackMisc::Aviation::CCallsign> m_queryAtis; //!< query the ATIS
|
QQueue<BlackMisc::Aviation::CCallsign> m_queryAtis; //!< query the ATIS
|
||||||
QQueue<BlackMisc::Aviation::CCallsign> m_queryPilot; //!< query the pilot data
|
QQueue<BlackMisc::Aviation::CCallsign> m_queryPilot; //!< query the pilot data
|
||||||
QMap<BlackMisc::Aviation::CCallsign, BlackMisc::Aviation::CAircraftSituation> m_fullSituations; //!< last reported full position
|
|
||||||
Fsd::CFSDClient *m_fsdClient = nullptr; //!< corresponding network interface
|
Fsd::CFSDClient *m_fsdClient = nullptr; //!< corresponding network interface
|
||||||
CAirspaceAnalyzer *m_analyzer = nullptr; //!< owned analyzer
|
CAirspaceAnalyzer *m_analyzer = nullptr; //!< owned analyzer
|
||||||
bool m_bookingsRequested = false; //!< bookings have been requested, it can happen we receive an BlackCore::Vatsim::CVatsimBookingReader::atcBookingsReadUnchanged signal
|
bool m_bookingsRequested = false; //!< bookings have been requested, it can happen we receive an BlackCore::Vatsim::CVatsimBookingReader::atcBookingsReadUnchanged signal
|
||||||
|
|||||||
@@ -86,6 +86,12 @@ namespace BlackMisc::Simulation
|
|||||||
m_pitchDelta = correctTurnDirection(m_pitchDelta);
|
m_pitchDelta = correctTurnDirection(m_pitchDelta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CInterpolatorVelocity::CInterpolant::update(qint64 currentMsSinceEpoch)
|
||||||
|
{
|
||||||
|
Q_ASSERT_X(currentMsSinceEpoch >= m_creationTimeMsSinceEpoch, Q_FUNC_INFO, "Updated current time must be greater creation time");
|
||||||
|
m_currentTimeMsSinceEpoch = currentMsSinceEpoch;
|
||||||
|
}
|
||||||
|
|
||||||
void CInterpolatorVelocity::anchor()
|
void CInterpolatorVelocity::anchor()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ namespace BlackMisc
|
|||||||
|
|
||||||
//! Update interpolant to given timestamp. Every following call to
|
//! Update interpolant to given timestamp. Every following call to
|
||||||
//! interpolatePositionAndAltitude(..) will return the situation according to this timestamp.
|
//! interpolatePositionAndAltitude(..) will return the situation according to this timestamp.
|
||||||
void update(qint64 currentMsSinceEpoch) { m_currentTimeMsSinceEpoch = currentMsSinceEpoch; }
|
void update(qint64 currentMsSinceEpoch);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Aviation::CAircraftSituation m_currentSitutation;
|
Aviation::CAircraftSituation m_currentSitutation;
|
||||||
|
|||||||
@@ -289,14 +289,10 @@ namespace BlackMisc::Simulation
|
|||||||
{
|
{
|
||||||
newSituationsList.prefillLatestAdjustedFirst(situationCorrected, IRemoteAircraftProvider::MaxSituationsPerCallsign);
|
newSituationsList.prefillLatestAdjustedFirst(situationCorrected, IRemoteAircraftProvider::MaxSituationsPerCallsign);
|
||||||
}
|
}
|
||||||
else if (!situationCorrected.hasVelocity() && newSituationsList.front().hasVelocity())
|
|
||||||
{
|
|
||||||
return situationCorrected;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// newSituationsList.push_frontKeepLatestFirstIgnoreOverlapping(situationCorrected, true, IRemoteAircraftProvider::MaxSituationsPerCallsign);
|
newSituationsList.push_frontKeepLatestFirstIgnoreOverlapping(situationCorrected, true, IRemoteAircraftProvider::MaxSituationsPerCallsign);
|
||||||
newSituationsList.push_frontKeepLatestFirstAdjustOffset(situationCorrected, true, IRemoteAircraftProvider::MaxSituationsPerCallsign);
|
// newSituationsList.push_frontKeepLatestFirstAdjustOffset(situationCorrected, true, IRemoteAircraftProvider::MaxSituationsPerCallsign);
|
||||||
newSituationsList.setAdjustedSortHint(CAircraftSituationList::AdjustedTimestampLatestFirst);
|
newSituationsList.setAdjustedSortHint(CAircraftSituationList::AdjustedTimestampLatestFirst);
|
||||||
newSituationsList.transferElevationForward(); // transfer elevations, will do nothing if elevations already exist
|
newSituationsList.transferElevationForward(); // transfer elevations, will do nothing if elevations already exist
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user