Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
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
12struct 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
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;
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
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
119struct 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;
195 float rudder;
198 float spoilers;
199};
200
201#endif
202
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*/
252struct 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
309extern void net_fdm_dump (struct FGNetFDM* fdm);
310extern void net_fdm_ntoh (struct FGNetFDM* fdm);
311extern void net_fdm_init (struct FGNetFDM* fdm);
312
313extern void net_gui_init (struct FGNetGUI* gui);
314extern void net_gui_hton (struct FGNetGUI* gui);
315extern void net_gui_dump (struct FGNetGUI* gui);
316
317extern void net_ctrls_dump(struct FGNetCtrls* ctrls);
318extern void net_ctrls_ntoh(struct FGNetCtrls* ctrls);
319
320#endif /* FLIGHT_GEAR_H */
double copilot_brake_left
Definition flight_gear.h:63
uint32_t flaps_power
Definition flight_gear.h:27
double latitude
float agl
float climb_rate
float wind_from_north
double brake_left
Definition flight_gear.h:61
uint32_t freeze
Definition flight_gear.h:99
double prop_advance[FG_NET_CTRLS_MAX_ENGINES]
Definition flight_gear.h:40
double flaps
Definition flight_gear.h:22
uint32_t reverse[4]
Definition flight_gear.h:42
double speedbrake
Definition flight_gear.h:24
float v_east
float A_Y_pilot
void net_gui_dump(struct FGNetGUI *gui)
uint32_t padding
double latitude
float A_X_pilot
float slip_deg
uint32_t mag_right_ok[FG_NET_CTRLS_MAX_ENGINES]
Definition flight_gear.h:47
double copilot_brake_right
Definition flight_gear.h:64
float wind_from_east
float gear_pos[FG_NET_FDM_MAX_WHEELS]
double condition[FG_NET_CTRLS_MAX_ENGINES]
Definition flight_gear.h:38
double wind_dir_deg
Definition flight_gear.h:81
uint32_t master_bat[FG_NET_CTRLS_MAX_ENGINES]
Definition flight_gear.h:32
double longitude
float phi
float stall_warning
uint32_t master_avionics
Definition flight_gear.h:71
double latitude
float elevator
#define FG_NET_CTRLS_MAX_ENGINES
Definition flight_gear.h:7
uint32_t master_alt[FG_NET_CTRLS_MAX_ENGINES]
Definition flight_gear.h:33
double wind_speed_kt
Definition flight_gear.h:80
float climb_rate
float cht[FG_NET_FDM_MAX_ENGINES]
float phidot
float fuel_flow[FG_NET_FDM_MAX_ENGINES]
float course_deviation_deg
float left_flap
uint32_t cross_feed
Definition flight_gear.h:58
double elevator_trim
Definition flight_gear.h:20
uint32_t engine_ok[FG_NET_CTRLS_MAX_ENGINES]
Definition flight_gear.h:45
uint32_t feed_tank_to[4]
Definition flight_gear.h:41
float v_body_v
double rudder
Definition flight_gear.h:18
double aileron
Definition flight_gear.h:16
uint32_t num_tanks
uint32_t flap_motor_ok
Definition flight_gear.h:28
float vcas
void net_fdm_ntoh(struct FGNetFDM *fdm)
double magvar
Definition flight_gear.h:90
void net_ctrls_ntoh(struct FGNetCtrls *ctrls)
uint32_t wow[FG_NET_FDM_MAX_WHEELS]
#define FG_NET_CTRLS_RESERVED_SPACE
Definition flight_gear.h:10
float left_aileron
uint32_t cur_time
double turbulence_norm
Definition flight_gear.h:82
uint32_t mag_left_ok[FG_NET_CTRLS_MAX_ENGINES]
Definition flight_gear.h:46
double comm_2
Definition flight_gear.h:75
float gear_compression[FG_NET_FDM_MAX_WHEELS]
uint32_t warp
uint32_t num_engines
float spoilers
float ground_elev
double press_inhg
Definition flight_gear.h:86
int32_t warp
void net_gui_init(struct FGNetGUI *gui)
uint32_t spark_plugs_ok[FG_NET_CTRLS_MAX_ENGINES]
Definition flight_gear.h:48
uint32_t xfer_pump[5]
Definition flight_gear.h:55
#define FG_NET_CTRLS_MAX_TANKS
Definition flight_gear.h:9
float right_aileron
uint32_t num_tanks
double fuel_quantity[FG_NET_FDM_MAX_TANKS]
uint32_t num_engines
Definition flight_gear.h:31
float visibility
uint32_t version
double comm_1
Definition flight_gear.h:74
float v_down
double temp_c
Definition flight_gear.h:85
float alpha
uint32_t padding1
float mp_osi[FG_NET_FDM_MAX_ENGINES]
uint32_t fuel_selector[FG_NET_CTRLS_MAX_TANKS]
Definition flight_gear.h:54
float rpm[FG_NET_FDM_MAX_ENGINES]
#define FG_NET_FDM_MAX_ENGINES
double hground
Definition flight_gear.h:89
double longitude
uint32_t oil_press_status[FG_NET_CTRLS_MAX_ENGINES]
Definition flight_gear.h:49
double altitude
float beta
double nav_2
Definition flight_gear.h:77
float v_north
uint32_t num_wheels
uint32_t version
float dist_nm
float nose_wheel
float psi
float theta
double altitude
float tit[FG_NET_FDM_MAX_ENGINES]
float altitude
double longitude
void net_fdm_dump(struct FGNetFDM *fdm)
uint32_t starter_power[FG_NET_CTRLS_MAX_ENGINES]
Definition flight_gear.h:35
uint32_t gear_handle
Definition flight_gear.h:68
float v_body_w
double spoilers
Definition flight_gear.h:23
float elevator_trim_tab
uint32_t num_tanks
Definition flight_gear.h:53
float fuel_quantity[FG_NET_FDM_MAX_TANKS]
float A_Z_pilot
uint32_t magnetos[FG_NET_CTRLS_MAX_ENGINES]
Definition flight_gear.h:34
uint32_t fuel_pump_power[FG_NET_CTRLS_MAX_ENGINES]
Definition flight_gear.h:39
double nav_1
Definition flight_gear.h:76
float thetadot
uint32_t speedup
Definition flight_gear.h:98
uint32_t num_tanks
float agl
float fuel_quantity[FG_NET_GUI_MAX_TANKS]
double aileron_trim
Definition flight_gear.h:19
float phi
float oil_temp[FG_NET_FDM_MAX_ENGINES]
float theta
float vcas
#define FG_NET_FDM_MAX_WHEELS
#define FG_NET_FDM_MAX_TANKS
float right_flap
void net_gui_hton(struct FGNetGUI *gui)
float nav_radial
double climb_rate
void net_fdm_init(struct FGNetFDM *fdm)
float egt[FG_NET_FDM_MAX_ENGINES]
float oil_px[FG_NET_FDM_MAX_ENGINES]
double mixture[FG_NET_CTRLS_MAX_ENGINES]
Definition flight_gear.h:37
uint32_t icing
Definition flight_gear.h:93
float fuel_px[FG_NET_FDM_MAX_ENGINES]
double elevator
Definition flight_gear.h:17
uint32_t cur_time
double throttle[FG_NET_CTRLS_MAX_ENGINES]
Definition flight_gear.h:36
uint32_t version
Definition flight_gear.h:13
float wind_from_down
double elapsed_sec
float rudder
double rudder_trim
Definition flight_gear.h:21
float v_body_u
uint32_t version
double brake_parking
Definition flight_gear.h:65
float gs_deviation_deg
float gear_steer[FG_NET_FDM_MAX_WHEELS]
uint32_t fuel_pump_ok[FG_NET_CTRLS_MAX_ENGINES]
Definition flight_gear.h:50
float tuned_freq
float speedbrake
float psi
void net_ctrls_dump(struct FGNetCtrls *ctrls)
#define FG_NET_GUI_MAX_TANKS
uint32_t in_range
float psidot
uint32_t eng_state[FG_NET_FDM_MAX_ENGINES]
uint32_t reserved[FG_NET_CTRLS_RESERVED_SPACE]
float wind_from_heading
double brake_right
Definition flight_gear.h:62
uint32_t footer_magic
uint32_t cur_time
uint16_t foo
Definition main_demo5.c:58
struct NpsFdm fdm
Holds all necessary NPS FDM state information.
int int32_t
Typedef defining 32 bit int type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.