]> git.mxchange.org Git - flightgear.git/blob - src/FDM/flightProperties.hxx
considering u,v,wbody-fps are the ECEF velocity expressed in body axis, change in...
[flightgear.git] / src / FDM / flightProperties.hxx
1 // flightProperties.hxx -- expose FDM properties via helper methods
2 //
3 // Written by James Turner, started June 2010.
4 //
5 // Copyright (C) 2010  Curtis L. Olson  - http://www.flightgear.org/~curt
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20 //
21 // $Id$
22
23 #ifndef FG_FLIGHT_PROPERTIES_HXX
24 #define FG_FLIGHT_PROPERTIES_HXX
25
26 #ifdef HAVE_CONFIG_H
27 #  include <config.h>
28 #endif
29
30 #include <cstring>
31 #include <simgear/math/SGMathFwd.hxx> // for SGVec3d 
32 #include <simgear/math/SGMisc.hxx>
33
34 // forward decls
35 class SGPropertyNode;
36 class SGGeoc;
37 class SGGeod;
38
39 /**
40  * Encapsulate the FDM properties in some getter/setter helpers.
41  * This class intentionally mimics portions of
42  * @FGInterface, to permit easy migration of code outside the FDMs,
43  * to use properties instead of global variables.
44  */
45 class FlightProperties
46 {
47 public:
48   FlightProperties(SGPropertyNode* aRoot = NULL);
49   ~FlightProperties();
50
51   double get_V_north() const;
52   double get_V_east() const;
53   double get_V_down() const;
54   double get_uBody () const;
55   double get_vBody () const;
56   double get_wBody () const;
57   
58   double get_A_X_pilot() const;
59   double get_A_Y_pilot() const;
60   double get_A_Z_pilot() const;
61   
62   double get_P_body() const;
63   double get_Q_body() const;
64   double get_R_body() const;
65     
66   SGGeod getPosition() const;
67
68   double get_Latitude() const;
69   double get_Longitude() const;
70   double get_Altitude() const;
71   
72   double get_Altitude_AGL(void) const;
73   double get_Track(void) const;
74
75   double get_Latitude_deg () const;
76   double get_Longitude_deg () const;
77   
78   double get_Phi_deg() const;
79   double get_Theta_deg() const;
80   double get_Psi_deg() const;
81   
82   double get_Phi() const { return SGMiscd::deg2rad(get_Phi_deg()); }
83   double get_Theta() const { return SGMiscd::deg2rad(get_Theta_deg()); }
84   double get_Psi() const { return SGMiscd::deg2rad(get_Psi_deg()); }
85
86   double get_Phi_dot() const;
87   double get_Theta_dot() const;
88   double get_Psi_dot() const;
89   double get_Alpha() const;
90   double get_Beta() const;
91   
92   double get_Phi_dot_degps() const;
93   double get_Theta_dot_degps() const;
94   double get_Psi_dot_degps() const;
95   
96   double get_V_ground_speed() const; // in feet/s
97   double get_V_equiv_kts() const;
98   double get_V_calibrated_kts() const;
99   double get_Climb_Rate() const;
100   double get_Runway_altitude_m() const;
101   
102   double get_Total_temperature() const;
103   double get_Total_pressure() const;
104   double get_Dynamic_pressure() const;
105   
106   void set_Longitude(double l); // radians
107   void set_Latitude(double l); // radians
108   void set_Altitude(double ft); // feet
109     
110   void set_Euler_Angles(double phi, double theta, double psi);
111   void set_Euler_Rates(double x, double y, double z);
112   
113   void set_Alpha(double a);
114   void set_Beta(double b);
115   
116   void set_Altitude_AGL(double ft);
117   
118   void set_V_calibrated_kts(double kts);
119   void set_Climb_Rate(double fps);
120   
121   void set_Velocities_Local(double x, double y, double z);
122   void set_Velocities_Body(double x, double y, double z);
123   void set_Accels_Pilot_Body(double x, double y, double z);
124 private:
125   SGPropertyNode* _root;
126 };
127
128 #endif // of FG_FLIGHT_PROPERTIES_HXX