]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/models/flight_control/FGGyro.h
sync. with JSBSim CVS again
[flightgear.git] / src / FDM / JSBSim / models / flight_control / FGGyro.h
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3  Header:       FGGyro.h
4  Author:       Jon Berndt
5  Date started: 29 August 2009
6
7  ------------- Copyright (C) 2009 -------------
8
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU Lesser General Public License as published by the Free Software
11  Foundation; either version 2 of the License, or (at your option) any later
12  version.
13
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 Lesser General Public License for more
17  details.
18
19  You should have received a copy of the GNU Lesser 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.
22
23  Further information about the GNU Lesser General Public License can also be found on
24  the world wide web at http://www.gnu.org.
25
26 HISTORY
27 --------------------------------------------------------------------------------
28
29 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
30 SENTRY
31 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
32
33 #ifndef FGGYRO_H
34 #define FGGYRO_H
35
36 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
37 INCLUDES
38 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
39
40 #include "FGSensor.h"
41 #include "input_output/FGXMLElement.h"
42 #include "models/FGPropagate.h"
43 #include "models/FGMassBalance.h"
44 #include "models/FGInertial.h"
45 #include "math/FGColumnVector3.h"
46 #include "math/FGMatrix33.h"
47 #include "FGSensorOrientation.h"
48
49 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
50 DEFINITIONS
51 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
52
53 #define ID_GYRO "$Id$"
54
55 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
56 FORWARD DECLARATIONS
57 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
58
59 namespace JSBSim {
60
61 class FGFCS;
62
63 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
64 CLASS DOCUMENTATION
65 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
66
67 /** Encapsulates a Gyro component for the flight control system.
68
69 Syntax:
70
71 @code
72 <gyro name="name">
73   <input> property </input>
74   <lag> number </lag>
75   <noise variation="PERCENT|ABSOLUTE"> number </noise>
76   <quantization name="name">
77     <bits> number </bits>
78     <min> number </min>
79     <max> number </max>
80   </quantization>
81   <drift_rate> number </drift_rate>
82   <bias> number </bias>
83 </gyro>
84 @endcode
85
86 Example:
87
88 @code
89 <gyro name="aero/gyro/qbar">
90   <input> aero/qbar </input>
91   <lag> 0.5 </lag>
92   <noise variation="PERCENT"> 2 </noise>
93   <quantization name="aero/gyro/quantized/qbar">
94     <bits> 12 </bits>
95     <min> 0 </min>
96     <max> 400 </max>
97   </quantization>
98   <bias> 0.5 </bias>
99 </gyro>
100 @endcode
101
102 The only required element in the gyro definition is the input element. In that
103 case, no degradation would be modeled, and the output would simply be the input.
104
105 For noise, if the type is PERCENT, then the value supplied is understood to be a
106 percentage variance. That is, if the number given is 0.05, the the variance is
107 understood to be +/-0.05 percent maximum variance. So, the actual value for the gyro
108 will be *anywhere* from 0.95 to 1.05 of the actual "perfect" value at any time -
109 even varying all the way from 0.95 to 1.05 in adjacent frames - whatever the delta
110 time.
111
112 @author Jon S. Berndt
113 @version $Revision$
114 */
115
116 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
117 CLASS DECLARATION
118 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
119
120 class FGGyro  : public FGSensor, public FGSensorOrientation
121 {
122 public:
123   FGGyro(FGFCS* fcs, Element* element);
124   ~FGGyro();
125
126   bool Run (void);
127
128 private:
129   FGPropagate* Propagate;
130   FGColumnVector3 vAccel;
131   void CalculateTransformMatrix(void);
132   
133   void Debug(int from);
134 };
135 }
136 #endif