1 // flightProperties.hxx -- expose FDM properties via helper methods
3 // Written by James Turner, started June 2010.
5 // Copyright (C) 2010 Curtis L. Olson - http://www.flightgear.org/~curt
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.
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.
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.
23 #ifndef FG_FLIGHT_PROPERTIES_HXX
24 #define FG_FLIGHT_PROPERTIES_HXX
31 #include <simgear/math/SGMathFwd.hxx> // for SGVec3d
32 #include <simgear/math/SGMisc.hxx>
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.
45 class FlightProperties
48 FlightProperties(SGPropertyNode* aRoot = NULL);
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;
58 double get_A_X_pilot() const;
59 double get_A_Y_pilot() const;
60 double get_A_Z_pilot() const;
62 double get_P_body() const;
63 double get_Q_body() const;
64 double get_R_body() const;
66 SGGeod getPosition() const;
68 double get_Latitude() const;
69 double get_Longitude() const;
70 double get_Altitude() const;
72 double get_Altitude_AGL(void) const;
73 double get_Track(void) const;
75 double get_Latitude_deg () const;
76 double get_Longitude_deg () const;
78 double get_Phi_deg() const;
79 double get_Theta_deg() const;
80 double get_Psi_deg() const;
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()); }
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;
92 double get_Phi_dot_degps() const;
93 double get_Theta_dot_degps() const;
94 double get_Psi_dot_degps() const;
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;
102 double get_Total_temperature() const;
103 double get_Total_pressure() const;
104 double get_Dynamic_pressure() const;
106 void set_Longitude(double l); // radians
107 void set_Latitude(double l); // radians
108 void set_Altitude(double ft); // feet
110 void set_Euler_Angles(double phi, double theta, double psi);
111 void set_Euler_Rates(double x, double y, double z);
113 void set_Alpha(double a);
114 void set_Beta(double b);
116 void set_Altitude_AGL(double ft);
118 void set_V_calibrated_kts(double kts);
119 void set_Climb_Rate(double fps);
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);
125 SGPropertyNode* _root;
128 #endif // of FG_FLIGHT_PROPERTIES_HXX