13 using namespace swift::misc::aviation;
15 namespace swift::core::fsd
17 VisualPilotDataPeriodic::VisualPilotDataPeriodic() : MessageBase() {}
19 VisualPilotDataPeriodic::VisualPilotDataPeriodic(
const QString &sender,
double latitude,
double longitude,
20 double altitudeTrue,
double heightAgl,
double pitch,
double bank,
21 double heading,
double xVelocity,
double yVelocity,
22 double zVelocity,
double pitchRadPerSec,
double bankRadPerSec,
23 double headingRadPerSec,
double noseGearAngle)
24 :
MessageBase(sender, {}), m_latitude(latitude), m_longitude(longitude), m_altitudeTrue(altitudeTrue),
25 m_heightAgl(heightAgl), m_pitch(pitch), m_bank(bank), m_heading(heading), m_xVelocity(xVelocity),
26 m_yVelocity(yVelocity), m_zVelocity(zVelocity), m_pitchRadPerSec(pitchRadPerSec),
27 m_bankRadPerSec(bankRadPerSec), m_headingRadPerSec(headingRadPerSec), m_noseGearAngle(noseGearAngle)
37 tokens.push_back(QString::number(
m_latitude,
'f', 7));
38 tokens.push_back(QString::number(
m_longitude,
'f', 7));
40 tokens.push_back(QString::number(
m_heightAgl,
'f', 2));
41 tokens.push_back(QString::number(pbh));
42 tokens.push_back(QString::number(
m_xVelocity,
'f', 4));
43 tokens.push_back(QString::number(
m_yVelocity,
'f', 4));
44 tokens.push_back(QString::number(
m_zVelocity,
'f', 4));
54 if (tokens.size() < 12)
64 unpackPBH(tokens[5].toUInt(), pitch, bank, heading, unused);
67 tokens[0], tokens[1].toDouble(), tokens[2].toDouble(), tokens[3].toDouble(), tokens[4].toDouble(), pitch,
68 bank, heading, tokens[6].toDouble(), tokens[7].toDouble(), tokens[8].toDouble(), tokens[9].toDouble(),
69 tokens[11].toDouble(), tokens[10].toDouble(), tokens.value(12, QStringLiteral(
"0")).toDouble());
QString m_sender
message sender
Every 25th VisualPilotDataUpdate is actually one of these ("slowfast").
double m_noseGearAngle
Properties.
QStringList toTokens() const
Message converted to tokens.
double m_yVelocity
Properties.
double m_pitch
Properties.
double m_pitchRadPerSec
Properties.
static VisualPilotDataPeriodic fromTokens(const QStringList &tokens)
Construct from tokens.
double m_headingRadPerSec
Properties.
double m_heightAgl
Properties.
double m_latitude
Properties.
double m_longitude
Properties.
VisualPilotDataUpdate toUpdate() const
Return a regular visual update with the same values.
double m_heading
Properties.
double m_xVelocity
Properties.
double m_altitudeTrue
Properties.
double m_bankRadPerSec
Properties.
double m_zVelocity
Properties.
Pilot data update broadcasted to pilots in range every 0.2 seconds.
Class for emitting a log message.
Derived & debug()
Set the severity to debug.
Free functions in swift::misc.
void unpackPBH(quint32 pbh, double &pitch, double &bank, double &heading, bool &onGround)
Unpack pitch, bank, heading and onGround from 32 bit integer.
void packPBH(double pitch, double bank, double heading, bool onGround, quint32 &pbh)
Pack pitch, bank, heading and onGround into 32 bit integer.