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.
27 --------------------------------------------------------------------------------
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31 COMMENTS, REFERENCES, and NOTES
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
33 [1] Cooke, Zyda, Pratt, and McGhee, "NPSNET: Flight Simulation Dynamic Modeling
34 Using Quaternions", Presence, Vol. 1, No. 4, pp. 404-420 Naval Postgraduate
36 [2] D. M. Henderson, "Euler Angles, Quaternions, and Transformation Matrices",
38 [3] Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at
39 NASA-Ames", NASA CR-2497, January 1975
40 [4] Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
41 Wiley & Sons, 1979 ISBN 0-471-03032-5
42 [5] Bernard Etkin, "Dynamics of Flight, Stability and Control", Wiley & Sons,
43 1982 ISBN 0-471-08936-2
45 The order of rotations used in this class corresponds to a 3-2-1 sequence,
46 or Y-P-R, or Z-Y-X, if you prefer.
48 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
50 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
55 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
60 # include <simgear/compiler.h>
67 # include <simgear/constants.h>
74 #define ID_ROTATION "$Id$"
76 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
78 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
80 class FGRotation : public FGModel
83 FGRotation(FGFDMExec*);
88 inline FGColumnVector GetPQR(void) {return vPQR;}
89 inline float GetPQR(int axis) {return vPQR(axis);}
90 inline FGColumnVector GetPQRdot(void) {return vPQRdot;}
91 inline float GetPQRdot(int idx) {return vPQRdot(idx);}
92 inline FGColumnVector GetEuler(void) {return vEuler;}
93 inline float GetEuler(int axis) {return vEuler(axis);}
94 inline FGColumnVector GetEulerRates(void) { return vEulerRates; }
95 inline float GetEulerRates(int axis) { return vEulerRates(axis); }
96 inline void SetPQR(FGColumnVector tt) {vPQR = tt;}
97 inline void SetEuler(FGColumnVector tt) {vEuler = tt;}
99 inline float Getphi(void) {return vEuler(1);}
100 inline float Gettht(void) {return vEuler(2);}
101 inline float Getpsi(void) {return vEuler(3);}
103 inline float GetCosphi(void) {return cPhi;}
104 inline float GetCostht(void) {return cTht;}
105 inline float GetCospsi(void) {return cPsi;}
107 inline float GetSinphi(void) {return sPhi;}
108 inline float GetSintht(void) {return sTht;}
109 inline float GetSinpsi(void) {return sPsi;}
113 FGColumnVector vPQRdot;
114 FGColumnVector vMoments;
115 FGColumnVector vEuler;
116 FGColumnVector vEulerRates;
117 FGColumnVector vlastPQRdot;
123 float Ixx, Iyy, Izz, Ixz;
131 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%