Reflecting discussed changes for interpolation performance refs #386

(based on FSX testing)
* Only send changed situation to SIM
* Split sending of parts / situations
* Only send parts with a reduced frequency (means slower as positions)
* Mark geodetic height as null for default values (the value is usually unavailable)
* Fixed altitude to MSL for network data
* Trace which aircrafts support aircraft parts via network
* Renamed insert_fron push_front (as proposed by Roland)

Status quo / lessons learnt
* On slower PCs jitter is still noticed for interpolated aircraft.
* Running interpolation in an independent process (aka core, not in GUI) reduced load dependencies
  => it seems to make sense to run driver in own thread
* The onGround flag in parts seems clumsy as it required to retrieve parts for position updates
* In interpolation performance really matters
This commit is contained in:
Klaus Basan
2015-02-26 21:47:28 +01:00
parent ca6cd9c063
commit eca8c5b637
21 changed files with 376 additions and 320 deletions

View File

@@ -111,16 +111,16 @@ namespace BlackMisc
CLength heightAboveGround(this->getHeightAboveGround());
if (!heightAboveGround.isNull())
{
return heightAboveGround.value(CLengthUnit::m()) < 2.0;
return heightAboveGround.value(CLengthUnit::m()) < 1.0;
}
// we guess on pitch an bank
if (qAbs(this->getPitch().value(CAngleUnit::deg())) > 10) { return false; }
if (qAbs(this->getBank().value(CAngleUnit::deg())) > 10) { return false; }
if (qAbs(this->getBank().value(CAngleUnit::deg())) > 10) { return false; }
if (this->getGroundSpeed().value(CSpeedUnit::km_h()) > 80) { return false; }
// not sure, but his is a guess
// not sure, but this is a guess
return true;
}

View File

@@ -183,7 +183,7 @@ namespace BlackMisc
BLACK_ENABLE_TUPLE_CONVERSION(CCoordinateGeodetic)
BlackMisc::Geo::CLatitude m_latitude; //!< Latitude
BlackMisc::Geo::CLongitude m_longitude; //!< Longitude
BlackMisc::PhysicalQuantities::CLength m_geodeticHeight; //!< height, ellipsoidal or geodetic height
BlackMisc::PhysicalQuantities::CLength m_geodeticHeight { 0, BlackMisc::PhysicalQuantities::CLengthUnit::nullUnit() }; //!< height, ellipsoidal or geodetic height
};
} // namespace

View File

@@ -234,6 +234,12 @@ namespace BlackMisc
*/
void push_back(const T &value) { Q_ASSERT(pimpl()); pimpl()->push_back(value); }
/*!
* \brief Insert as first element.
* \pre The sequence must be initialized.
*/
void push_front(const T &value) { insert(begin(), value); }
/*!
* \brief Move-appends an element at the end of the sequence.
* \pre The sequence must be initialized.
@@ -272,12 +278,6 @@ namespace BlackMisc
*/
void insert(T &&value) { push_back(std::move(value)); }
/*!
* \brief Insert as first element.
* \pre The sequence must be initialized.
*/
void insert_front(const T &value) { insert(begin(), value); }
/*!
* \brief Synonym for push_back.
* \pre The sequence must be initialized.
@@ -376,7 +376,7 @@ namespace BlackMisc
*/
int applyIf(const CPropertyIndexVariantMap &pattern, const CPropertyIndexVariantMap &newValues, bool skipEqualValues = false)
{
return applyIf([ & ](const T &value) { return value == pattern; }, newValues, skipEqualValues);
return applyIf([ & ](const T & value) { return value == pattern; }, newValues, skipEqualValues);
}
/*!

View File

@@ -75,7 +75,7 @@ namespace BlackMisc
void CRemoteAircraftProviderDummy::insertNewSituation(const CAircraftSituation &situation)
{
this->m_situations.insertTimestampObject(situation, 20);
this->m_situations.push_frontMaxElements(situation, 20);
emit addedRemoteAircraftSituation(situation);
}

View File

@@ -55,6 +55,17 @@ namespace BlackMisc
return this->findBy(Predicates::MemberValid(&CSimulatedAircraft::getPilot)).transform(Predicates::MemberTransform(&CSimulatedAircraft::getPilot));
}
CCallsignList CSimulatedAircraftList::getCallsignsWithSyncronizedParts() const
{
CCallsignList csl;
for (const CSimulatedAircraft &aircraft : (*this))
{
if (!aircraft.isPartsSynchronized()) { continue; }
csl.push_back(aircraft.getCallsign());
}
return csl;
}
CAircraftList CSimulatedAircraftList::toAircraftList() const
{
CAircraftList al;

View File

@@ -43,6 +43,9 @@ namespace BlackMisc
//! All pilots (with valid data)
BlackMisc::Network::CUserList getPilots() const;
//! Callsigns of aircraft with synchronized parts
BlackMisc::Aviation::CCallsignList getCallsignsWithSyncronizedParts() const;
//! \copydoc CValueObject::toQVariant
virtual QVariant toQVariant() const override { return QVariant::fromValue(*this); }

View File

@@ -29,6 +29,14 @@ namespace BlackMisc
});
}
template <class OBJ, class CONTAINER>
CONTAINER ITimestampObjectList<OBJ, CONTAINER>::findBeforeAndRemove(qint64 msSinceEpoch)
{
CONTAINER result(findBefore(msSinceEpoch));
this->removeBefore(msSinceEpoch);
return result;
}
template <class OBJ, class CONTAINER>
CONTAINER ITimestampObjectList<OBJ, CONTAINER>::findBeforeNowMinusOffset(qint64 msOffset) const
{
@@ -75,18 +83,18 @@ namespace BlackMisc
OBJ ITimestampObjectList<OBJ, CONTAINER>::latestValue() const
{
if (this->container().isEmpty()) { return OBJ(); }
CONTAINER container(container()); // copy
container.sortLatestFirst();
return container.front();
CONTAINER copy(container()); // copy
copy.sortLatestFirst();
return copy.front();
}
template <class OBJ, class CONTAINER>
OBJ ITimestampObjectList<OBJ, CONTAINER>::oldestValue() const
{
if (this->container().isEmpty()) { return OBJ(); }
CONTAINER container(container()); // copy
container.sortLatestFirst();
return container.back();
CONTAINER copy(container()); // copy
copy.sortLatestFirst();
return copy.back();
}
template <class OBJ, class CONTAINER>
@@ -134,14 +142,14 @@ namespace BlackMisc
}
template <class OBJ, class CONTAINER>
void ITimestampObjectList<OBJ, CONTAINER>::insertTimestampObject(const OBJ &object, int maxElements)
void ITimestampObjectList<OBJ, CONTAINER>::push_frontMaxElements(const OBJ &object, int maxElements)
{
Q_ASSERT(maxElements > 1);
if (this->container().size() >= (maxElements - 1))
{
this->container().truncate(maxElements - 1);
}
this->container().insert_front(object);
this->container().push_front(object);
}
// see here for the reason of thess forward instantiations

View File

@@ -32,6 +32,9 @@ namespace BlackMisc
//! List of objects before msSinceEpoch
CONTAINER findBefore(qint64 msSinceEpoch) const;
//! Get objects before msSinceEpoch and remove those
CONTAINER findBeforeAndRemove(qint64 msSinceEpoch);
//! List of objects before now - offset
CONTAINER findBeforeNowMinusOffset(qint64 msOffset) const;
@@ -67,7 +70,7 @@ namespace BlackMisc
void sortOldestFirst();
//! Inserts as first object by keeping max. elements
void insertTimestampObject(const OBJ &object, int maxElements);
void push_frontMaxElements(const OBJ &object, int maxElements);
protected:
//! Constructor