1 /*******************************************************************************
7 ------------- Copyright (C) 1999 Jon S. Berndt (jsb@hal-pc.org) -------------
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU General Public License as published by the Free Software
11 Foundation; either version 2 of the License, or (at your option) any later
14 This program is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19 You should have received a copy of the GNU General Public License along with
20 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21 Place - Suite 330, Boston, MA 02111-1307, USA.
23 Further information about the GNU General Public License can also be found on
24 the world wide web at http://www.gnu.org.
26 FUNCTIONAL DESCRIPTION
27 --------------------------------------------------------------------------------
29 Based on Flightgear code, which is based on LaRCSim. This class wraps all
30 global state variables (such as velocity, position, orientation, etc.).
33 --------------------------------------------------------------------------------
35 *******************************************************************************/
37 /*******************************************************************************
39 *******************************************************************************/
44 /*******************************************************************************
46 *******************************************************************************/
51 /*******************************************************************************
53 *******************************************************************************/
55 /*******************************************************************************
57 *******************************************************************************/
66 bool StoreData(char*);
68 bool DisplayData(void);
70 inline float GetU(void) {return U;}
71 inline float GetV(void) {return V;}
72 inline float GetW(void) {return W;}
74 inline float GetVn(void) {return Vn;}
75 inline float GetVe(void) {return Ve;}
76 inline float GetVd(void) {return Vd;}
78 inline float GetVt(void) {return Vt;}
80 inline float GetFx(void) {return Fx;}
81 inline float GetFy(void) {return Fy;}
82 inline float GetFz(void) {return Fz;}
84 inline float GetP(void) {return P;}
85 inline float GetQ(void) {return Q;}
86 inline float GetR(void) {return R;}
88 inline float GetQ0(void) {return Q0;}
89 inline float GetQ1(void) {return Q1;}
90 inline float GetQ2(void) {return Q2;}
91 inline float GetQ3(void) {return Q3;}
93 inline float GetL(void) {return L;}
94 inline float GetM(void) {return M;}
95 inline float GetN(void) {return N;}
97 inline float GetIxx(void) const {return Ixx;}
98 inline float GetIyy(void) const {return Iyy;}
99 inline float GetIzz(void) const {return Izz;}
100 inline float GetIxz(void) const {return Ixz;}
102 inline float Getlatitude(void) {return latitude;}
103 inline float Getlongitude(void) {return longitude;}
104 inline float GetGeodeticLat(void) {return GeodeticLat;}
106 inline float Getalpha(void) {return alpha;}
107 inline float Getbeta(void) {return beta;}
108 inline float Getgamma(void) {return gamma;}
110 inline float Getadot(void) {return adot;}
111 inline float Getbdot(void) {return bdot;}
113 inline float GetUdot(void) {return Udot;}
114 inline float GetVdot(void) {return Vdot;}
115 inline float GetWdot(void) {return Wdot;}
117 inline float GetPdot(void) {return Pdot;}
118 inline float GetQdot(void) {return Qdot;}
119 inline float GetRdot(void) {return Rdot;}
121 inline float Geth(void) {return h;}
122 inline float Geta(void) {return a;}
123 inline float GetMach(void) {return Mach;}
125 inline float Getrho(void) {return rho;}
126 inline float Getsim_time(void) {return sim_time;}
127 inline float Getdt(void) {return dt;}
129 inline float Getphi(void) {return phi;}
130 inline float Gettht(void) {return tht;}
131 inline float Getpsi(void) {return psi;}
133 inline float Getg(void) {return g;}
134 inline float Getm(void) {return m;}
136 inline float Getqbar(void) {return qbar;}
137 inline float GetT(int r, int c) {return T[r][c];}
139 inline void SetU(float tt) {U = tt;}
140 inline void SetV(float tt) {V = tt;}
141 inline void SetW(float tt) {W = tt;}
143 inline void SetVt(float tt) {Vt = tt;}
145 inline void SetVn(float tt) {Vn = tt;}
146 inline void SetVe(float tt) {Ve = tt;}
147 inline void SetVd(float tt) {Vd = tt;}
149 inline void SetFx(float tt) {Fx = tt;}
150 inline void SetFy(float tt) {Fy = tt;}
151 inline void SetFz(float tt) {Fz = tt;}
153 inline void SetP(float tt) {P = tt;}
154 inline void SetQ(float tt) {Q = tt;}
155 inline void SetR(float tt) {R = tt;}
157 inline void SetL(float tt) {L = tt;}
158 inline void SetM(float tt) {M = tt;}
159 inline void SetN(float tt) {N = tt;}
161 inline void SetIxx(float tt) {Ixx = tt;}
162 inline void SetIyy(float tt) {Iyy = tt;}
163 inline void SetIzz(float tt) {Izz = tt;}
164 inline void SetIxz(float tt) {Ixz = tt;}
166 inline void Setlatitude(float tt) {latitude = tt;}
167 inline void Setlongitude(float tt) {longitude = tt;}
168 inline void SetGeodeticLat(float tt) {GeodeticLat = tt;}
170 inline void Setalpha(float tt) {alpha = tt;}
171 inline void Setbeta(float tt) {beta = tt;}
172 inline void Setgamma(float tt) {gamma = tt;}
174 inline void Setadot(float tt) {adot = tt;}
175 inline void Setbdot(float tt) {bdot = tt;}
177 inline void SetUdot(float tt) {Udot = tt;}
178 inline void SetVdot(float tt) {Vdot = tt;}
179 inline void SetWdot(float tt) {Wdot = tt;}
181 inline void SetPdot(float tt) {Pdot = tt;}
182 inline void SetQdot(float tt) {Qdot = tt;}
183 inline void SetRdot(float tt) {Rdot = tt;}
185 inline void Setphi(float tt) {phi = tt;}
186 inline void Settht(float tt) {tht = tt;}
187 inline void Setpsi(float tt) {psi = tt;}
189 inline void Setg(float tt) {g = tt;}
190 inline void Setm(float tt) {m = tt;}
191 inline void Setqbar(float tt) {qbar = tt;}
193 inline void Seth(float tt) {h = tt;}
194 inline void Seta(float tt) {a = tt;}
195 inline void SetMach(float tt) {Mach = tt;}
197 inline void Setrho(float tt) {rho = tt;}
198 inline float Setsim_time(float tt) {sim_time = tt; return sim_time;}
199 inline void Setdt(float tt) {dt = tt;}
200 inline void SetQ0123(float q0, float q1, float q2, float q3) {Q0=q0;Q1=q1;Q2=q2;Q3=q3;}
201 inline void SetT(int r, int c, float tt) {T[r][c] = tt;}
203 inline float IncrTime(void) {sim_time+=dt;return sim_time;}
205 const float EarthRad;
209 float U, V, W, Fx, Fy, Fz; // A/C body axis velocities and forces
210 float P, Q, R, L, M, N; // A/C body axis rates and moments
211 float Q0, Q1, Q2, Q3; // Quaternion elements
212 float Ixx, Iyy, Izz, Ixz; // Moments of Inertia
213 float Vt; // Total velocity
214 float Vn, Ve, Vd; // North, East, and Down local velocities
215 float latitude, longitude; // position
216 float GeodeticLat; // Geodetic Latitude
217 float alpha, beta, gamma; // angle of attack, sideslip, and roll
218 float adot, bdot; // alpha dot and beta dot
219 float phi, tht, psi; // Euler angles
220 float Udot, Vdot, Wdot; // A/C body axis accelerations
221 float Pdot, Qdot, Rdot; // A/C body axis rotational accelerations
222 float h, a; // altitude above sea level, speed of sound
223 float rho, qbar; // density of air in lb/ft^3, dynamic pressure
225 float m, g; // mass and acceleration of gravity
226 float T[4][4]; // Local to Body transformation matrix
227 float Mach; // Mach number
235 extern FGState* State;
240 /******************************************************************************/