swift
visualpilotdataupdate.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2019 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_CORE_FSD_VISUALPILOTDATAUPDATE_H
7 #define SWIFT_CORE_FSD_VISUALPILOTDATAUPDATE_H
8 
9 #include "enums.h"
10 #include "messagebase.h"
11 
12 namespace swift::core::fsd
13 {
14  class VisualPilotDataPeriodic;
15  class VisualPilotDataStopped;
16 
19  {
20  public:
22  VisualPilotDataUpdate(const QString &sender, double latitude, double longitude, double altitudeTrue,
23  double heightAgl, double pitch, double bank, double heading, double xVelocity,
24  double yVelocity, double zVelocity, double pitchRadPerSec, double bankRadPerSec,
25  double headingRadPerSec, double noseGearAngle = 0.0);
26 
28  QStringList toTokens() const;
29 
31  static VisualPilotDataUpdate fromTokens(const QStringList &tokens);
32 
34  static QString pdu() { return "^"; }
35 
37  VisualPilotDataPeriodic toPeriodic() const;
38 
40  VisualPilotDataStopped toStopped() const;
41 
44  double m_latitude = 0.0;
45  double m_longitude = 0.0;
46  double m_altitudeTrue = 0.0;
47  double m_heightAgl = 0.0;
48  double m_pitch = 0.0;
49  double m_bank = 0.0;
50  double m_heading = 0.0;
51  double m_xVelocity = 0.0;
52  double m_yVelocity = 0.0;
53  double m_zVelocity = 0.0;
54  double m_pitchRadPerSec = 0.0;
55  double m_bankRadPerSec = 0.0;
56  double m_headingRadPerSec = 0.0;
57  double m_noseGearAngle = 0.0;
59 
60  // private: // not private: used in CFSDClient::handleVisualPilotDataUpdate
62  };
63 
65  inline bool operator==(const VisualPilotDataUpdate &lhs, const VisualPilotDataUpdate &rhs)
66  {
67  return qFuzzyCompare(lhs.m_latitude, rhs.m_latitude) && qFuzzyCompare(lhs.m_longitude, rhs.m_longitude) &&
68  qFuzzyCompare(lhs.m_altitudeTrue, rhs.m_altitudeTrue) &&
69  qFuzzyCompare(lhs.m_heightAgl, rhs.m_heightAgl) && qFuzzyCompare(lhs.m_pitch, rhs.m_pitch) &&
70  qFuzzyCompare(lhs.m_bank, rhs.m_bank) && qFuzzyCompare(lhs.m_heading, rhs.m_heading) &&
71  qFuzzyCompare(lhs.m_xVelocity, rhs.m_xVelocity) && qFuzzyCompare(lhs.m_yVelocity, rhs.m_yVelocity) &&
72  qFuzzyCompare(lhs.m_zVelocity, rhs.m_zVelocity) &&
73  qFuzzyCompare(lhs.m_pitchRadPerSec, rhs.m_pitchRadPerSec) &&
74  qFuzzyCompare(lhs.m_bankRadPerSec, rhs.m_bankRadPerSec) &&
75  qFuzzyCompare(lhs.m_headingRadPerSec, rhs.m_headingRadPerSec) &&
76  qFuzzyCompare(lhs.m_noseGearAngle, rhs.m_noseGearAngle);
77  }
78 
80  inline bool operator!=(const VisualPilotDataUpdate &lhs, const VisualPilotDataUpdate &rhs) { return !(lhs == rhs); }
81 } // namespace swift::core::fsd
82 
83 #endif // SWIFT_CORE_FSD_VISUALPILOTDATAUPDATE_H
bool operator!=(const AddAtc &lhs, const AddAtc &rhs)
Not equal operator.
Definition: addatc.h:68
FSD message base class.
Definition: messagebase.h:58
Every 25th VisualPilotDataUpdate is actually one of these ("slowfast").
VisualPilotDataUpdate with velocity assumed to be zero.
Pilot data update broadcasted to pilots in range every 0.2 seconds.
static QString pdu()
PDU identifier.
#define SWIFT_CORE_EXPORT
Export a class or function from the library.