]> git.mxchange.org Git - flightgear.git/blob - src/Network/net_fdm_mini.hxx
c3c0b70bd93d4b8f447fa589c3b16293b3ca56a0
[flightgear.git] / src / Network / net_fdm_mini.hxx
1 // net_fdm_mini.hxx -- defines a simple subset I/O interface to the flight
2 //                     dynamics model variables
3 //
4 // Written by Curtis Olson - http://www.flightgear.org/~curt
5 // Started January 2002.
6 //
7 // This file is in the Public Domain, and comes with no warranty.
8 //
9 // $Id$
10
11
12 #ifndef _NET_FDM_MINI_HXX
13 #define _NET_FDM_MINI_HXX
14
15
16 #ifndef __cplusplus                                                          
17 # error This library requires C++
18 #endif                                   
19
20
21 // NOTE: this file defines an external interface structure.  Due to
22 // variability between platforms and architectures, we only used fixed
23 // length types here.  Specifically, integer types can vary in length.
24 // I am not aware of any platforms that don't use 4 bytes for float
25 // and 8 bytes for double.
26
27 #ifdef HAVE_STDINT_H
28 # include <stdint.h>
29 #elif defined( _MSC_VER ) || defined(__MINGW32__)
30 typedef signed char      int8_t;
31 typedef signed short     int16_t;
32 typedef signed int       int32_t;
33 typedef signed __int64   int64_t;
34 typedef unsigned char    uint8_t;
35 typedef unsigned short   uint16_t;
36 typedef unsigned int     uint32_t;
37 typedef unsigned __int64 uint64_t;
38 #else
39 # error "Port me! Platforms that don't have <stdint.h> need to define int8_t, et. al."
40 #endif
41
42
43 const uint32_t FG_NET_FDM_MINI_VERSION = 2;
44
45
46 // Define a structure containing the top level flight dynamics model
47 // parameters
48
49 class FGNetMiniFDM {
50
51 public:
52
53     enum {
54         FG_MAX_ENGINES = 4,
55         FG_MAX_WHEELS = 3,
56         FG_MAX_TANKS = 4
57     };
58
59     uint32_t version;           // increment when data values change
60
61     // Positions
62     double longitude;           // geodetic (radians)
63     double latitude;            // geodetic (radians)
64     double altitude;            // above sea level (meters)
65     double agl;                 // above ground level (meters)
66     double phi;                 // roll (radians)
67     double theta;               // pitch (radians)
68     double psi;                 // yaw or true heading (radians)
69
70     // Velocities
71     double vcas;
72     double climb_rate;          // feet per second
73
74     // Consumables
75     uint32_t num_tanks;         // Max number of fuel tanks
76     double fuel_quantity[FG_MAX_TANKS];
77
78     // Environment
79     uint32_t cur_time;            // current unix time
80     int32_t warp;                 // offset in seconds to unix time
81 };
82
83
84 #endif // _NET_FDM_MINI_HXX