]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGRotation.h
- fixed fuel-need calculations
[flightgear.git] / src / FDM / JSBSim / FGRotation.h
index 09452f5d0293531e7ef6de76145d656478031779..50989e8efb81d5f3db9045fbceba8a83d8309a4d 100644 (file)
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
  Header:       FGRotation.h
  Author:       Jon Berndt
@@ -27,9 +27,9 @@ HISTORY
 --------------------------------------------------------------------------------
 12/02/98   JSB   Created
 
-********************************************************************************
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 COMMENTS, REFERENCES,  and NOTES
-********************************************************************************
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 [1] Cooke, Zyda, Pratt, and McGhee, "NPSNET: Flight Simulation Dynamic Modeling
     Using Quaternions", Presence, Vol. 1, No. 4, pp. 404-420  Naval Postgraduate
     School, January 1994
@@ -45,100 +45,96 @@ COMMENTS, REFERENCES,  and NOTES
   The order of rotations used in this class corresponds to a 3-2-1 sequence,
   or Y-P-R, or Z-Y-X, if you prefer.
 
-********************************************************************************
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 SENTRY
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #ifndef FGROTATION_H
 #define FGROTATION_H
 
-/*******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 INCLUDES
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #ifdef FGFS
 #  include <simgear/compiler.h>
-#  ifdef FG_HAVE_STD_INCLUDES
-#    include <cmath>
-#  else
+#  include <math.h>
+#else
+#  if defined (sgi) && !defined(__GNUC__)
 #    include <math.h>
+#  else
+#    include <cmath>
 #  endif
-#else
-#  include <cmath>
 #endif
 
 #include "FGModel.h"
+#include "FGMatrix33.h"
+#include "FGColumnVector3.h"
+#include "FGColumnVector4.h"
 
-using namespace std;
+#define ID_ROTATION "$Id$"
 
-/*******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DECLARATION
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 class FGRotation : public FGModel
 {
 public:
   FGRotation(FGFDMExec*);
-  ~FGRotation(void);
+  ~FGRotation();
 
   bool Run(void);
 
-  inline float GetP(void) {return P;}
-  inline float GetQ(void) {return Q;}
-  inline float GetR(void) {return R;}
-
-  inline float GetPdot(void) {return Pdot;}
-  inline float GetQdot(void) {return Qdot;}
-  inline float GetRdot(void) {return Rdot;}
-
-  inline float Getphi(void) {return phi;}
-  inline float Gettht(void) {return tht;}
-  inline float Getpsi(void) {return psi;}
-
-  inline float GetQ0(void) {return Q0;}
-  inline float GetQ1(void) {return Q1;}
-  inline float GetQ2(void) {return Q2;}
-  inline float GetQ3(void) {return Q3;}
-
-  inline void SetP(float tt) {P = tt;}
-  inline void SetQ(float tt) {Q = tt;}
-  inline void SetR(float tt) {R = tt;}
-
-  inline void SetPQR(float t1, float t2, float t3) {P=t1;
-                                                    Q=t2;
-                                                    R=t3;}
-
-  inline void Setphi(float tt) {phi = tt;}
-  inline void Settht(float tt) {tht = tt;}
-  inline void Setpsi(float tt) {psi = tt;}
-
-  inline void SetEuler(float t1, float t2, float t3) {phi=t1;
-                                                      tht=t2;
-                                                      psi=t3;}
-
-  inline void SetQ0123(float t1, float t2, float t3, float t4) {Q0=t1;
-                                                                Q1=t2;
-                                                                Q2=t3;
-                                                                Q3=t4;}
-
-protected:
+  inline FGColumnVector3& GetPQR(void) {return vPQR;}
+  inline double GetPQR(int axis) {return vPQR(axis);}
+  inline FGColumnVector3& GetAeroPQR(void) {return vAeroPQR;}
+  inline double GetAeroPQR(int axis) {return vAeroPQR(axis);}
+  inline FGColumnVector3& GetPQRdot(void) {return vPQRdot;}
+  inline double GetPQRdot(int idx) {return vPQRdot(idx);}
+  inline FGColumnVector3& GetEuler(void) {return vEuler;}
+  inline double GetEuler(int axis) {return vEuler(axis);}
+  inline FGColumnVector3& GetEulerRates(void) { return vEulerRates; }
+  inline double GetEulerRates(int axis) { return vEulerRates(axis); }
+  inline void SetPQR(FGColumnVector3 tt) {vPQR = tt;}
+  inline void SetPQR(double p, double q, double r) {vPQR(eP)=p;
+                                                    vPQR(eQ)=q;
+                                                    vPQR(eR)=r;}
+  inline void SetEuler(FGColumnVector3 tt) {vEuler = tt;}
+  
+  inline double Getphi(void) {return vEuler(1);}
+  inline double Gettht(void) {return vEuler(2);}
+  inline double Getpsi(void) {return vEuler(3);}
+  
+  inline double GetCosphi(void) {return cPhi;}
+  inline double GetCostht(void) {return cTht;}
+  inline double GetCospsi(void) {return cPsi;}
+
+  inline double GetSinphi(void) {return sPhi;}
+  inline double GetSintht(void) {return sTht;}
+  inline double GetSinpsi(void) {return sPsi;}
 
 private:
-  float P, Q, R;
-  float L, M, N;
-  float Ixx, Iyy, Izz, Ixz;
-  float Q0, Q1, Q2, Q3;
-  float phi, tht, psi;
-  float Pdot, Qdot, Rdot;
-  float Q0dot, Q1dot, Q2dot, Q3dot;
-  float lastPdot, lastQdot, lastRdot;
-  float lastQ0dot, lastQ1dot, lastQ2dot, lastQ3dot;
-  float dt;
-  float T[4][4];
+  FGColumnVector3 vPQR;
+  FGColumnVector3 vAeroPQR;
+  FGColumnVector3 vPQRdot;
+  FGColumnVector3 vMoments;
+  FGColumnVector3 vEuler;
+  FGColumnVector3 vEulerRates;
+  FGColumnVector3 vlastPQRdot;
+  
+  double cTht,sTht;
+  double cPhi,sPhi;
+  double cPsi,sPsi;
+  
+  double Ixx, Iyy, Izz, Ixz;
+  double dt;
 
   void GetState(void);
-  void PutState(void);
+
+  void Debug(int from);
 };
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 #endif
+