Paparazzi UAS  v5.10_stable-5-g83a0da5-dirty
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
flight_gear.h
Go to the documentation of this file.
1 #ifndef FLIGHT_GEAR_H
2 #define FLIGHT_GEAR_H
3 
4 #include <stdint.h>
5 
6 #define FG_NET_CTRLS_VERSION 27
7 #define FG_NET_CTRLS_MAX_ENGINES 4
8 #define FG_NET_CTRLS_MAX_WHEELS 16
9 #define FG_NET_CTRLS_MAX_TANKS 8
10 #define FG_NET_CTRLS_RESERVED_SPACE 25
11 
12 struct FGNetCtrls {
13  uint32_t version; // increment when data values change
14 
15  // Aero controls
16  double aileron; // -1 ... 1
17  double elevator; // -1 ... 1
18  double rudder; // -1 ... 1
19  double aileron_trim; // -1 ... 1
20  double elevator_trim; // -1 ... 1
21  double rudder_trim; // -1 ... 1
22  double flaps; // 0 ... 1
23  double spoilers;
24  double speedbrake;
25 
26  // Aero control faults
27  uint32_t flaps_power; // true = power available
29 
30  // Engine controls
31  uint32_t num_engines; // number of valid engines
36  double throttle[FG_NET_CTRLS_MAX_ENGINES]; // 0 ... 1
37  double mixture[FG_NET_CTRLS_MAX_ENGINES]; // 0 ... 1
38  double condition[FG_NET_CTRLS_MAX_ENGINES]; // 0 ... 1
43 
44  // Engine faults
49  uint32_t oil_press_status[FG_NET_CTRLS_MAX_ENGINES];// 0 = normal, 1 = low, 2 = full fail
51 
52  // Fuel management
53  uint32_t num_tanks; // number of valid tanks
54  uint32_t fuel_selector[FG_NET_CTRLS_MAX_TANKS]; // false = off, true = on
55  uint32_t xfer_pump[5]; // specifies transfer from array
56  // value tank to tank specified by
57  // int value
58  uint32_t cross_feed; // false = off, true = on
59 
60  // Brake controls
61  double brake_left;
62  double brake_right;
65  double brake_parking;
66 
67  // Landing Gear
68  uint32_t gear_handle; // true=gear handle down; false= gear handle up
69 
70  // Switches
72 
73  // nav and Comm
74  double comm_1;
75  double comm_2;
76  double nav_1;
77  double nav_2;
78 
79  // wind and turbulance
80  double wind_speed_kt;
81  double wind_dir_deg;
83 
84  // temp and pressure
85  double temp_c;
86  double press_inhg;
87 
88  // other information about environment
89  double hground; // ground elevation (meters)
90  double magvar; // local magnetic variation in degs.
91 
92  // hazards
93  uint32_t icing; // icing status could me much
94  // more complex but I'm
95  // starting simple here.
96 
97  // simulation control
98  uint32_t speedup; // integer speedup multiplier
99  uint32_t freeze; // 0=normal
100  // 0x01=master
101  // 0x02=position
102  // 0x04=fuel
103 
104  // --- New since FlightGear 0.9.10 (FG_NET_CTRLS_VERSION = 27)
105 
106  // --- Add new variables just before this line.
107 
108  uint32_t reserved[FG_NET_CTRLS_RESERVED_SPACE]; // 100 bytes reserved for future use.
109 };
110 
111 
112 #define FG_NET_FDM_VERSION 24
113 #define FG_NET_FDM_MAX_ENGINES 4
114 #define FG_NET_FDM_MAX_WHEELS 3
115 #define FG_NET_FDM_MAX_TANKS 4
116 
117 #ifndef _NET_FDM_HXX
118 
119 struct FGNetFDM {
120 
121  uint32_t version; // increment when data values change
122  uint32_t padding; // padding
123 
124  // Positions
125  double longitude; // geodetic (radians)
126  double latitude; // geodetic (radians)
127  double altitude; // above sea level (meters)
128  float agl; // above ground level (meters)
129  float phi; // roll (radians)
130  float theta; // pitch (radians)
131  float psi; // yaw or true heading (radians)
132  float alpha; // angle of attack (radians)
133  float beta; // side slip angle (radians)
134 
135  // Velocities
136  float phidot; // roll rate (radians/sec)
137  float thetadot; // pitch rate (radians/sec)
138  float psidot; // yaw rate (radians/sec)
139  float vcas; // calibrated airspeed
140  float climb_rate; // feet per second
141  float v_north; // north velocity in local/body frame, fps
142  float v_east; // east velocity in local/body frame, fps
143  float v_down; // down/vertical velocity in local/body frame, fps
144  float v_body_u; // ECEF velocity in body frame
145  float v_body_v; // ECEF velocity in body frame
146  float v_body_w; // ECEF velocity in body frame
147 
148  // Accelerations
149  float A_X_pilot; // X accel in body frame ft/sec^2
150  float A_Y_pilot; // Y accel in body frame ft/sec^2
151  float A_Z_pilot; // Z accel in body frame ft/sec^2
152  // Stall
153  float stall_warning; // 0.0 - 1.0 indicating the amount of stall
154  float slip_deg; // slip ball deflection
155 
156  // Pressure
157 
158  // Engine status
159  uint32_t num_engines; // Number of valid engines
160  uint32_t eng_state[FG_NET_FDM_MAX_ENGINES]; // Engine state (off, cranking, running)
161  float rpm[FG_NET_FDM_MAX_ENGINES]; // Engine RPM rev/min
162  float fuel_flow[FG_NET_FDM_MAX_ENGINES]; // Fuel flow gallons/hr
163  float fuel_px[FG_NET_FDM_MAX_ENGINES]; // Fuel pressure psi
164  float egt[FG_NET_FDM_MAX_ENGINES]; // Exhuast gas temp deg F
165  float cht[FG_NET_FDM_MAX_ENGINES]; // Cylinder head temp deg F
166  float mp_osi[FG_NET_FDM_MAX_ENGINES]; // Manifold pressure
167  float tit[FG_NET_FDM_MAX_ENGINES]; // Turbine Inlet Temperature
168  float oil_temp[FG_NET_FDM_MAX_ENGINES]; // Oil temp deg F
169  float oil_px[FG_NET_FDM_MAX_ENGINES]; // Oil pressure psi
170 
171  // Consumables
172  uint32_t num_tanks; // Max number of fuel tanks
174 
175  // Gear status
181 
182  // Environment
183  uint32_t cur_time; // current unix time
184  // FIXME: make this uint64_t before 2038
185  int32_t warp; // offset in seconds to unix time
186  float visibility; // visibility in meters (for env. effects)
187 
188  // Control surface positions (normalized values)
189  float elevator;
191  float left_flap;
192  float right_flap;
195  float rudder;
196  float nose_wheel;
197  float speedbrake;
198  float spoilers;
199 };
200 
201 #endif
202 
203 struct FGNetMiniFDM {
204  uint32_t version; // increment when data values change
205 
206  // Positions
207  double longitude; // geodetic (radians)
208  double latitude; // geodetic (radians)
209  double altitude; // above sea level (meters)
210  double agl; // above ground level (meters)
211  double phi; // roll (radians)
212  double theta; // pitch (radians)
213  double psi; // yaw or true heading (radians)
214 
215  // Velocities
216  double vcas;
217  double climb_rate; // feet per second
218 
219  // Consumables
220  uint32_t num_tanks; // Max number of fuel tanks
222 
223  // Environment
224  uint32_t cur_time; // current unix time
225  int32_t warp; // offset in seconds to unix time
226 };
227 
228 #if FG_2_4
229 #define FG_NET_GUI_VERSION 7
230 #else
231 #define FG_NET_GUI_VERSION 8
232 #endif /*FG_2_4*/
233 
234 #define FG_NET_GUI_MAX_TANKS 4
235 
236 // Prior to FG_NET_GUI_VERSION 8, OS X needed #pragma pack(4) to
237 // properly display FG visualization data. In version 8 they added
238 // a padding1 element to ensure proper data alignment, so this is
239 // no longer required. The rest of this struct is based on FG source
240 // in src/Network/net_gui.hxx
241 
242 #if FG_2_4
243 #ifdef __x86_64__
244 #pragma pack(push)
245 #ifdef __APPLE__
246 #pragma pack(4)
247 #else
248 #pragma pack(8)
249 #endif /*__APPLE__*/
250 #endif /*__x86_64__*/
251 #endif /*FG_2_4*/
252 struct FGNetGUI {
253  uint32_t version; // increment when data values change
255 
256  // Positions
257  double longitude; // geodetic (radians)
258  double latitude; // geodetic (radians)
259  float altitude; // above sea level (meters)
260  float agl; // above ground level (meters)
261  float phi; // roll (radians)
262  float theta; // pitch (radians)
263  float psi; // yaw or true heading (radians)
264 
265  // Velocities
266  float vcas;
267  float climb_rate; // feet per second
268 
269  // Consumables
270  uint32_t num_tanks; // Max number of fuel tanks
272 
273  // Environment
274  uint32_t cur_time; // current unix time
275  // FIXME: make this uint64_t before 2038
276  uint32_t warp; // offset in seconds to unix time
277  float ground_elev; // ground elev (meters)
278 
279  // Approach
280  float tuned_freq; // currently tuned frequency
281  float nav_radial; // target nav radial
282  uint32_t in_range; // tuned navaid is in range?
283  float dist_nm; // distance to tuned navaid in nautical miles
284  float course_deviation_deg; // degrees off target course
285  float gs_deviation_deg; // degrees off target glide slope
286 };
287 #if FG_2_4
288 #ifdef __x86_64__
289 #pragma pack(push)
290 #pragma pack(pop)
291 #endif /*__x86_64__*/
292 #endif /*FG_2_4*/
293 
294 
295 #define FG_ENVIRONMENT_FOOTER_MAGIC 0x12345678
296 // described in file fg_environment.xml (generic protocol)
298  double elapsed_sec; // elapsed sim seconds
299  float wind_from_north; // wind from north in m/s
300  float wind_from_east; // wind from east in m/s
301  float wind_from_down; // wind from down in m/s
302  float wind_from_heading; // wind N-E heading in degrees
303  float wind_speed; // wind N-E speed in m/s
304  uint32_t footer_magic; // magic footer 0x12345678
305 };
306 
307 
308 
309 extern void net_fdm_dump (struct FGNetFDM* fdm);
310 extern void net_fdm_ntoh (struct FGNetFDM* fdm);
311 extern void net_fdm_init (struct FGNetFDM* fdm);
312 
313 extern void net_gui_init (struct FGNetGUI* gui);
314 extern void net_gui_hton (struct FGNetGUI* gui);
315 extern void net_gui_dump (struct FGNetGUI* gui);
316 
317 extern void net_ctrls_dump(struct FGNetCtrls* ctrls);
318 extern void net_ctrls_ntoh(struct FGNetCtrls* ctrls);
319 
320 #endif /* FLIGHT_GEAR_H */
float climb_rate
Definition: flight_gear.h:267
float spoilers
Definition: flight_gear.h:198
double aileron_trim
Definition: flight_gear.h:19
#define FG_NET_CTRLS_RESERVED_SPACE
Definition: flight_gear.h:10
float theta
Definition: flight_gear.h:130
uint32_t padding
Definition: flight_gear.h:122
uint32_t wow[FG_NET_FDM_MAX_WHEELS]
Definition: flight_gear.h:177
uint32_t engine_ok[FG_NET_CTRLS_MAX_ENGINES]
Definition: flight_gear.h:45
float elevator_trim_tab
Definition: flight_gear.h:190
float A_X_pilot
Definition: flight_gear.h:149
float visibility
Definition: flight_gear.h:186
uint32_t num_engines
Definition: flight_gear.h:31
uint32_t version
Definition: flight_gear.h:204
uint32_t num_tanks
Definition: flight_gear.h:270
float fuel_quantity[FG_NET_FDM_MAX_TANKS]
Definition: flight_gear.h:173
float left_aileron
Definition: flight_gear.h:193
uint32_t footer_magic
Definition: flight_gear.h:304
void net_fdm_ntoh(struct FGNetFDM *fdm)
float wind_speed
Definition: flight_gear.h:303
float egt[FG_NET_FDM_MAX_ENGINES]
Definition: flight_gear.h:164
struct NpsFdm fdm
Holds all necessary NPS FDM state information.
float left_flap
Definition: flight_gear.h:191
float gear_pos[FG_NET_FDM_MAX_WHEELS]
Definition: flight_gear.h:178
double temp_c
Definition: flight_gear.h:85
uint32_t fuel_selector[FG_NET_CTRLS_MAX_TANKS]
Definition: flight_gear.h:54
void net_ctrls_dump(struct FGNetCtrls *ctrls)
float agl
Definition: flight_gear.h:128
float nose_wheel
Definition: flight_gear.h:196
uint32_t num_wheels
Definition: flight_gear.h:176
double wind_speed_kt
Definition: flight_gear.h:80
double turbulence_norm
Definition: flight_gear.h:82
double comm_2
Definition: flight_gear.h:75
uint32_t cur_time
Definition: flight_gear.h:183
float altitude
Definition: flight_gear.h:259
double copilot_brake_right
Definition: flight_gear.h:64
double altitude
Definition: flight_gear.h:209
double mixture[FG_NET_CTRLS_MAX_ENGINES]
Definition: flight_gear.h:37
uint32_t mag_right_ok[FG_NET_CTRLS_MAX_ENGINES]
Definition: flight_gear.h:47
float cht[FG_NET_FDM_MAX_ENGINES]
Definition: flight_gear.h:165
float wind_from_north
Definition: flight_gear.h:299
double climb_rate
Definition: flight_gear.h:217
double spoilers
Definition: flight_gear.h:23
double latitude
Definition: flight_gear.h:126
float gear_steer[FG_NET_FDM_MAX_WHEELS]
Definition: flight_gear.h:179
double theta
Definition: flight_gear.h:212
double elapsed_sec
Definition: flight_gear.h:298
float thetadot
Definition: flight_gear.h:137
uint32_t spark_plugs_ok[FG_NET_CTRLS_MAX_ENGINES]
Definition: flight_gear.h:48
uint32_t oil_press_status[FG_NET_CTRLS_MAX_ENGINES]
Definition: flight_gear.h:49
float dist_nm
Definition: flight_gear.h:283
float vcas
Definition: flight_gear.h:266
uint32_t starter_power[FG_NET_CTRLS_MAX_ENGINES]
Definition: flight_gear.h:35
float A_Z_pilot
Definition: flight_gear.h:151
double aileron
Definition: flight_gear.h:16
uint32_t cur_time
Definition: flight_gear.h:274
float v_east
Definition: flight_gear.h:142
double press_inhg
Definition: flight_gear.h:86
float elevator
Definition: flight_gear.h:189
float phi
Definition: flight_gear.h:261
double nav_1
Definition: flight_gear.h:76
uint32_t fuel_pump_ok[FG_NET_CTRLS_MAX_ENGINES]
Definition: flight_gear.h:50
#define FG_NET_FDM_MAX_ENGINES
Definition: flight_gear.h:113
double latitude
Definition: flight_gear.h:208
int32_t warp
Definition: flight_gear.h:225
uint32_t speedup
Definition: flight_gear.h:98
float phi
Definition: flight_gear.h:129
uint32_t feed_tank_to[4]
Definition: flight_gear.h:41
uint32_t master_alt[FG_NET_CTRLS_MAX_ENGINES]
Definition: flight_gear.h:33
uint32_t warp
Definition: flight_gear.h:276
float stall_warning
Definition: flight_gear.h:153
float nav_radial
Definition: flight_gear.h:281
float A_Y_pilot
Definition: flight_gear.h:150
float vcas
Definition: flight_gear.h:139
uint32_t version
Definition: flight_gear.h:253
float v_body_w
Definition: flight_gear.h:146
double brake_left
Definition: flight_gear.h:61
float fuel_quantity[FG_NET_GUI_MAX_TANKS]
Definition: flight_gear.h:271
double brake_parking
Definition: flight_gear.h:65
float ground_elev
Definition: flight_gear.h:277
uint32_t flaps_power
Definition: flight_gear.h:27
float theta
Definition: flight_gear.h:262
uint32_t gear_handle
Definition: flight_gear.h:68
float beta
Definition: flight_gear.h:133
double rudder
Definition: flight_gear.h:18
uint32_t master_bat[FG_NET_CTRLS_MAX_ENGINES]
Definition: flight_gear.h:32
float fuel_px[FG_NET_FDM_MAX_ENGINES]
Definition: flight_gear.h:163
void net_ctrls_ntoh(struct FGNetCtrls *ctrls)
#define FG_NET_FDM_MAX_WHEELS
Definition: flight_gear.h:114
float agl
Definition: flight_gear.h:260
float tuned_freq
Definition: flight_gear.h:280
unsigned long uint32_t
Definition: types.h:18
uint32_t icing
Definition: flight_gear.h:93
uint32_t flap_motor_ok
Definition: flight_gear.h:28
double flaps
Definition: flight_gear.h:22
uint32_t num_tanks
Definition: flight_gear.h:53
double condition[FG_NET_CTRLS_MAX_ENGINES]
Definition: flight_gear.h:38
float fuel_flow[FG_NET_FDM_MAX_ENGINES]
Definition: flight_gear.h:162
uint32_t freeze
Definition: flight_gear.h:99
float psi
Definition: flight_gear.h:263
double longitude
Definition: flight_gear.h:125
float phidot
Definition: flight_gear.h:136
uint32_t padding1
Definition: flight_gear.h:254
float oil_temp[FG_NET_FDM_MAX_ENGINES]
Definition: flight_gear.h:168
void net_fdm_dump(struct FGNetFDM *fdm)
float v_down
Definition: flight_gear.h:143
uint32_t cross_feed
Definition: flight_gear.h:58
double fuel_quantity[FG_NET_FDM_MAX_TANKS]
Definition: flight_gear.h:221
float wind_from_down
Definition: flight_gear.h:301
double elevator
Definition: flight_gear.h:17
float climb_rate
Definition: flight_gear.h:140
void net_fdm_init(struct FGNetFDM *fdm)
float alpha
Definition: flight_gear.h:132
uint32_t num_tanks
Definition: flight_gear.h:220
signed long int32_t
Definition: types.h:19
float tit[FG_NET_FDM_MAX_ENGINES]
Definition: flight_gear.h:167
float v_north
Definition: flight_gear.h:141
uint32_t fuel_pump_power[FG_NET_CTRLS_MAX_ENGINES]
Definition: flight_gear.h:39
uint32_t num_tanks
Definition: flight_gear.h:172
float gs_deviation_deg
Definition: flight_gear.h:285
uint32_t in_range
Definition: flight_gear.h:282
uint32_t mag_left_ok[FG_NET_CTRLS_MAX_ENGINES]
Definition: flight_gear.h:46
uint32_t eng_state[FG_NET_FDM_MAX_ENGINES]
Definition: flight_gear.h:160
#define FG_NET_FDM_MAX_TANKS
Definition: flight_gear.h:115
double wind_dir_deg
Definition: flight_gear.h:81
float oil_px[FG_NET_FDM_MAX_ENGINES]
Definition: flight_gear.h:169
int32_t warp
Definition: flight_gear.h:185
uint32_t cur_time
Definition: flight_gear.h:224
double elevator_trim
Definition: flight_gear.h:20
float wind_from_heading
Definition: flight_gear.h:302
double copilot_brake_left
Definition: flight_gear.h:63
double hground
Definition: flight_gear.h:89
float psi
Definition: flight_gear.h:131
double magvar
Definition: flight_gear.h:90
uint32_t xfer_pump[5]
Definition: flight_gear.h:55
float mp_osi[FG_NET_FDM_MAX_ENGINES]
Definition: flight_gear.h:166
uint32_t magnetos[FG_NET_CTRLS_MAX_ENGINES]
Definition: flight_gear.h:34
double nav_2
Definition: flight_gear.h:77
uint32_t reverse[4]
Definition: flight_gear.h:42
double speedbrake
Definition: flight_gear.h:24
double latitude
Definition: flight_gear.h:258
uint32_t reserved[FG_NET_CTRLS_RESERVED_SPACE]
Definition: flight_gear.h:108
uint32_t version
Definition: flight_gear.h:13
uint32_t version
Definition: flight_gear.h:121
double altitude
Definition: flight_gear.h:127
double throttle[FG_NET_CTRLS_MAX_ENGINES]
Definition: flight_gear.h:36
float v_body_u
Definition: flight_gear.h:144
double comm_1
Definition: flight_gear.h:74
double prop_advance[FG_NET_CTRLS_MAX_ENGINES]
Definition: flight_gear.h:40
void net_gui_init(struct FGNetGUI *gui)
#define FG_NET_CTRLS_MAX_TANKS
Definition: flight_gear.h:9
float slip_deg
Definition: flight_gear.h:154
float rudder
Definition: flight_gear.h:195
float v_body_v
Definition: flight_gear.h:145
float right_flap
Definition: flight_gear.h:192
#define FG_NET_GUI_MAX_TANKS
Definition: flight_gear.h:234
uint32_t num_engines
Definition: flight_gear.h:159
float right_aileron
Definition: flight_gear.h:194
#define FG_NET_CTRLS_MAX_ENGINES
Definition: flight_gear.h:7
void net_gui_dump(struct FGNetGUI *gui)
float psidot
Definition: flight_gear.h:138
float rpm[FG_NET_FDM_MAX_ENGINES]
Definition: flight_gear.h:161
double brake_right
Definition: flight_gear.h:62
double longitude
Definition: flight_gear.h:257
uint32_t master_avionics
Definition: flight_gear.h:71
float wind_from_east
Definition: flight_gear.h:300
double longitude
Definition: flight_gear.h:207
float gear_compression[FG_NET_FDM_MAX_WHEELS]
Definition: flight_gear.h:180
float course_deviation_deg
Definition: flight_gear.h:284
void net_gui_hton(struct FGNetGUI *gui)
double rudder_trim
Definition: flight_gear.h:21
float speedbrake
Definition: flight_gear.h:197