Developmental Flight Test Instrumentation
server.hh
Go to the documentation of this file.
1 
9 #pragma once
10 
11 
12 // stdlib
13 #include <vector>
14 // 3rd party
15 #include <QDebug>
16 #include <QHostAddress>
17 #include <QObject>
18 #include <QPointer>
19 #include <QProcess>
20 #include <QTimer>
21 #include <QUdpSocket>
22 // dfti
23 #include "core/consts.hh"
24 #include "rio/rio.hh"
25 #include "settings/settings.hh"
26 #include "uadc/uadc.hh"
27 #include "util/util.hh"
28 #include "vn200/vn200.hh"
29 
30 
31 #define STATE_DATA_SIZE 10
32 
33 
34 namespace dfti {
35 
36 
55 #pragma pack(push, 1) // change structure packing to 1 byte
56 struct StateData
57 {
59  quint64 gpsTimeNs{0};
60 
62  float eulerDeg[3] = {0};
63 
65  float quaternion[4] = {0};
66 
68  float angularRatesRPS[3] = {0};
69 
71  float accelMps2[3] = {0};
72 
74  float iasMps{0};
75 
77  float aoaDeg{0};
78 
80  float aosDeg{0};
81 
83  quint8 numRIOValues{0};
84 
86  float rioValues[STATE_DATA_SIZE] = {0};
87 };
88 #pragma pack(pop) // reset structure packing
89 
90 
124 class Server : public QObject
125 {
126  Q_OBJECT;
127 
128 public:
130 
134  explicit Server(Settings *_settings, QObject* _parent = nullptr);
135 
137  ~Server();
138 
140 
143  void enableUADC(QPointer<uADC> adc);
144 
146 
149  void enableRIO(QPointer<RIO> rio);
150 
152 
155  void enableVN200(QPointer<VN200> ins);
156 
158 
161  void start(void);
162 
163 public slots:
165  void getRIOData(RIOData data);
166 
168  void getUADCData(uADCData data);
169 
171  void getVN200Data(VN200Data data);
172 
174  void writeData(void);
175 
176 private:
178  QPointer<Settings> settings{nullptr};
179 
181  QPointer<QUdpSocket> socket{nullptr};
182 
184  QHostAddress address{QHostAddress::LocalHost};
185 
187  quint16 port{2701};
188 
190  QPointer<QTimer> writeTimer;
191 
193  StateData stateData;
194 };
195 
196 
197 }; // namespace dfti
quint64 gpsTimeNs
INS GPS timestamp.
Definition: server.hh:59
float accelMps2[3]
INS accelerations.
Definition: server.hh:71
DFTI constants.
Structure to hold state data published.
Definition: server.hh:56
Structure to hold uADC data.
Definition: uadc.hh:69
float aosDeg
ADS sideslip angle.
Definition: server.hh:80
Aeroprobe Micro Air Data Computer interface.
float eulerDeg[3]
INS Euler angles.
Definition: server.hh:62
Definition: autopilot.cc:12
quint8 numRIOValues
Number of RIO values (up to 10).
Definition: server.hh:83
Settings manager.
Definition: settings.hh:30
Structure to hold control effector data.
Definition: rio.hh:53
float angularRatesRPS[3]
INS angular rates.
Definition: server.hh:68
float iasMps
ADS indicated airspeed.
Definition: server.hh:74
VectorNav VN-200 Inertial Navigation System interface.
float quaternion[4]
INS quaternion.
Definition: server.hh:65
UDP server for vehicle state data.
Definition: server.hh:124
Structure to hold VN-200 data.
Definition: vn200.hh:39
DFTI settings manager interface.
Utility functions.
Remote I/O logging interface.
float aoaDeg
ADS angle-of-attack.
Definition: server.hh:77
float rioValues[STATE_DATA_SIZE]
RIO values.
Definition: server.hh:86