mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-27 02:55:44 +08:00
T37 T127 Send timestamps to XSwiftBus as separate timestamp and offset
as the offset is needed for reliable interpolation.
This commit is contained in:
@@ -529,7 +529,8 @@ namespace BlackSimPlugin
|
|||||||
situation.getPitch().value(CAngleUnit::deg()),
|
situation.getPitch().value(CAngleUnit::deg()),
|
||||||
situation.getBank().value(CAngleUnit::deg()),
|
situation.getBank().value(CAngleUnit::deg()),
|
||||||
situation.getHeading().value(CAngleUnit::deg()),
|
situation.getHeading().value(CAngleUnit::deg()),
|
||||||
situation.getAdjustedMSecsSinceEpoch() - QDateTime::currentMSecsSinceEpoch());
|
situation.getMSecsSinceEpoch() - QDateTime::currentMSecsSinceEpoch(),
|
||||||
|
situation.getTimeOffsetMs());
|
||||||
|
|
||||||
if (! isRemoteAircraftSupportingParts(situation.getCallsign()))
|
if (! isRemoteAircraftSupportingParts(situation.getCallsign()))
|
||||||
{
|
{
|
||||||
@@ -569,7 +570,7 @@ namespace BlackSimPlugin
|
|||||||
parts.getFlapsPercent() / 100.0, parts.isSpoilersOut() ? 1 : 0, parts.isSpoilersOut() ? 1 : 0, parts.getFlapsPercent() / 100.0,
|
parts.getFlapsPercent() / 100.0, parts.isSpoilersOut() ? 1 : 0, parts.isSpoilersOut() ? 1 : 0, parts.getFlapsPercent() / 100.0,
|
||||||
0, parts.isAnyEngineOn() ? 0 : 0.75, 0, 0, 0,
|
0, parts.isAnyEngineOn() ? 0 : 0.75, 0, 0, 0,
|
||||||
parts.getLights().isLandingOn(), parts.getLights().isBeaconOn(), parts.getLights().isStrobeOn(), parts.getLights().isNavOn(),
|
parts.getLights().isLandingOn(), parts.getLights().isBeaconOn(), parts.getLights().isStrobeOn(), parts.getLights().isNavOn(),
|
||||||
0, parts.isOnGround(), parts.getAdjustedMSecsSinceEpoch() - QDateTime::currentMSecsSinceEpoch());
|
0, parts.isOnGround(), parts.getMSecsSinceEpoch() - QDateTime::currentMSecsSinceEpoch(), parts.getTimeOffsetMs());
|
||||||
m_traffic->setPlaneTransponder(callsign.asString(), 2000, true, false);
|
m_traffic->setPlaneTransponder(callsign.asString(), 2000, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -86,16 +86,16 @@ namespace BlackSimPlugin
|
|||||||
m_dbusInterface->callDBus(QLatin1String("removeAllPlanes"));
|
m_dbusInterface->callDBus(QLatin1String("removeAllPlanes"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CXSwiftBusTrafficProxy::addPlanePosition(const QString &callsign, double latitude, double longitude, double altitude, double pitch, double roll, double heading, qint64 relativeTime)
|
void CXSwiftBusTrafficProxy::addPlanePosition(const QString &callsign, double latitude, double longitude, double altitude, double pitch, double roll, double heading, qint64 relativeTime, qint64 timeOffset)
|
||||||
{
|
{
|
||||||
m_dbusInterface->callDBus(QLatin1String("addPlanePosition"), callsign, latitude, longitude, altitude, pitch, roll, heading, relativeTime);
|
m_dbusInterface->callDBus(QLatin1String("addPlanePosition"), callsign, latitude, longitude, altitude, pitch, roll, heading, relativeTime, timeOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CXSwiftBusTrafficProxy::addPlaneSurfaces(const QString &callsign, double gear, double flap, double spoiler, double speedBrake, double slat, double wingSweep, double thrust,
|
void CXSwiftBusTrafficProxy::addPlaneSurfaces(const QString &callsign, double gear, double flap, double spoiler, double speedBrake, double slat, double wingSweep, double thrust,
|
||||||
double elevator, double rudder, double aileron, bool landLight, bool beaconLight, bool strobeLight, bool navLight, int lightPattern, bool onGround, qint64 relativeTime)
|
double elevator, double rudder, double aileron, bool landLight, bool beaconLight, bool strobeLight, bool navLight, int lightPattern, bool onGround, qint64 relativeTime, qint64 timeOffset)
|
||||||
{
|
{
|
||||||
m_dbusInterface->callDBus(QLatin1String("addPlaneSurfaces"), callsign, gear, flap, spoiler, speedBrake, slat, wingSweep, thrust, elevator, rudder, aileron,
|
m_dbusInterface->callDBus(QLatin1String("addPlaneSurfaces"), callsign, gear, flap, spoiler, speedBrake, slat, wingSweep, thrust, elevator, rudder, aileron,
|
||||||
landLight, beaconLight, strobeLight, navLight, lightPattern, onGround, relativeTime);
|
landLight, beaconLight, strobeLight, navLight, lightPattern, onGround, relativeTime, timeOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CXSwiftBusTrafficProxy::setPlaneTransponder(const QString &callsign, int code, bool modeC, bool ident)
|
void CXSwiftBusTrafficProxy::setPlaneTransponder(const QString &callsign, int code, bool modeC, bool ident)
|
||||||
|
|||||||
@@ -103,11 +103,11 @@ namespace BlackSimPlugin
|
|||||||
void removeAllPlanes();
|
void removeAllPlanes();
|
||||||
|
|
||||||
//! \copydoc XSwiftBus::CTraffic::addPlanePosition
|
//! \copydoc XSwiftBus::CTraffic::addPlanePosition
|
||||||
void addPlanePosition(const QString &callsign, double latitude, double longitude, double altitude, double pitch, double roll, double heading, qint64 relativeTime);
|
void addPlanePosition(const QString &callsign, double latitude, double longitude, double altitude, double pitch, double roll, double heading, qint64 relativeTime, qint64 timeOffset);
|
||||||
|
|
||||||
//! \copydoc XSwiftBus::CTraffic::addPlaneSurfaces
|
//! \copydoc XSwiftBus::CTraffic::addPlaneSurfaces
|
||||||
void addPlaneSurfaces(const QString &callsign, double gear, double flap, double spoiler, double speedBrake, double slat, double wingSweep, double thrust,
|
void addPlaneSurfaces(const QString &callsign, double gear, double flap, double spoiler, double speedBrake, double slat, double wingSweep, double thrust,
|
||||||
double elevator, double rudder, double aileron, bool landLight, bool beaconLight, bool strobeLight, bool navLight, int lightPattern, bool onGround, qint64 relativeTime);
|
double elevator, double rudder, double aileron, bool landLight, bool beaconLight, bool strobeLight, bool navLight, int lightPattern, bool onGround, qint64 relativeTime, qint64 timeOffset);
|
||||||
|
|
||||||
//! \copydoc XSwiftBus::CTraffic::setPlaneTransponder
|
//! \copydoc XSwiftBus::CTraffic::setPlaneTransponder
|
||||||
void setPlaneTransponder(const QString &callsign, int code, bool modeC, bool ident);
|
void setPlaneTransponder(const QString &callsign, int code, bool modeC, bool ident);
|
||||||
|
|||||||
@@ -257,7 +257,7 @@ namespace XSwiftBus
|
|||||||
m_planesById.clear();
|
m_planesById.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTraffic::addPlanePosition(const QString &callsign, double latitude, double longitude, double altitude, double pitch, double roll, double heading, qint64 relativeTime)
|
void CTraffic::addPlanePosition(const QString &callsign, double latitude, double longitude, double altitude, double pitch, double roll, double heading, qint64 relativeTime, qint64 timeOffset)
|
||||||
{
|
{
|
||||||
const auto plane = m_planesByCallsign.value(callsign, nullptr);
|
const auto plane = m_planesByCallsign.value(callsign, nullptr);
|
||||||
if (plane)
|
if (plane)
|
||||||
@@ -273,14 +273,15 @@ namespace XSwiftBus
|
|||||||
CSpeed(0, CSpeedUnit::kts())
|
CSpeed(0, CSpeedUnit::kts())
|
||||||
);
|
);
|
||||||
situation.setMSecsSinceEpoch(relativeTime + QDateTime::currentMSecsSinceEpoch());
|
situation.setMSecsSinceEpoch(relativeTime + QDateTime::currentMSecsSinceEpoch());
|
||||||
|
situation.setTimeOffsetMs(timeOffset);
|
||||||
plane->interpolator.addAircraftSituation(situation);
|
plane->interpolator.addAircraftSituation(situation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTraffic::addPlaneSurfaces(const QString &callsign, double gear, double flap, double spoiler, double speedBrake, double slat, double wingSweep, double thrust,
|
void CTraffic::addPlaneSurfaces(const QString &callsign, double gear, double flap, double spoiler, double speedBrake, double slat, double wingSweep, double thrust,
|
||||||
double elevator, double rudder, double aileron, bool landLight, bool beaconLight, bool strobeLight, bool navLight, int lightPattern, bool onGround, qint64 relativeTime)
|
double elevator, double rudder, double aileron, bool landLight, bool beaconLight, bool strobeLight, bool navLight, int lightPattern, bool onGround, qint64 relativeTime, qint64 timeOffset)
|
||||||
{
|
{
|
||||||
const auto surfaces = std::make_pair(relativeTime + QDateTime::currentMSecsSinceEpoch(), [ = ](Plane *plane)
|
const auto surfaces = std::make_pair(relativeTime + timeOffset + QDateTime::currentMSecsSinceEpoch(), [ = ](Plane *plane)
|
||||||
{
|
{
|
||||||
plane->hasSurfaces = true;
|
plane->hasSurfaces = true;
|
||||||
plane->targetGearPosition = gear;
|
plane->targetGearPosition = gear;
|
||||||
@@ -309,6 +310,7 @@ namespace XSwiftBus
|
|||||||
BlackMisc::Aviation::CAircraftParts parts;
|
BlackMisc::Aviation::CAircraftParts parts;
|
||||||
parts.setOnGround(onGround);
|
parts.setOnGround(onGround);
|
||||||
parts.setMSecsSinceEpoch(relativeTime + QDateTime::currentMSecsSinceEpoch());
|
parts.setMSecsSinceEpoch(relativeTime + QDateTime::currentMSecsSinceEpoch());
|
||||||
|
parts.setTimeOffsetMs(timeOffset);
|
||||||
plane->interpolator.addAircraftParts(parts);
|
plane->interpolator.addAircraftParts(parts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,11 +107,11 @@ namespace XSwiftBus
|
|||||||
void removeAllPlanes();
|
void removeAllPlanes();
|
||||||
|
|
||||||
//! Set the position of a traffic aircraft
|
//! Set the position of a traffic aircraft
|
||||||
void addPlanePosition(const QString &callsign, double latitude, double longitude, double altitude, double pitch, double roll, double heading, qint64 relativeTime);
|
void addPlanePosition(const QString &callsign, double latitude, double longitude, double altitude, double pitch, double roll, double heading, qint64 relativeTime, qint64 timeOffset);
|
||||||
|
|
||||||
//! Set the flight control surfaces and lights of a traffic aircraft
|
//! Set the flight control surfaces and lights of a traffic aircraft
|
||||||
void addPlaneSurfaces(const QString &callsign, double gear, double flap, double spoiler, double speedBrake, double slat, double wingSweep, double thrust,
|
void addPlaneSurfaces(const QString &callsign, double gear, double flap, double spoiler, double speedBrake, double slat, double wingSweep, double thrust,
|
||||||
double elevator, double rudder, double aileron, bool landLight, bool beaconLight, bool strobeLight, bool navLight, int lightPattern, bool onGround, qint64 relativeTime);
|
double elevator, double rudder, double aileron, bool landLight, bool beaconLight, bool strobeLight, bool navLight, int lightPattern, bool onGround, qint64 relativeTime, qint64 timeOffset);
|
||||||
|
|
||||||
//! Set the transponder of a traffic aircraft
|
//! Set the transponder of a traffic aircraft
|
||||||
void setPlaneTransponder(const QString &callsign, int code, bool modeC, bool ident);
|
void setPlaneTransponder(const QString &callsign, int code, bool modeC, bool ident);
|
||||||
|
|||||||
Reference in New Issue
Block a user