]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/models/flight_control/FGGyro.h
Merge branch 'next' of gitorious.org:fg/flightgear into next
[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 "math/FGColumnVector3.h"
43 #include "math/FGMatrix33.h"
44 #include "FGSensorOrientation.h"
45
46 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
47 DEFINITIONS
48 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
49
50 #define ID_GYRO "$Id: FGGyro.h,v 1.6 2011/07/17 13:51:23 jberndt Exp $"
51
52 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
53 FORWARD DECLARATIONS
54 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
55
56 namespace JSBSim {
57
58 class FGFCS;
59 class FGAccelerations;
60
61 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
62 CLASS DOCUMENTATION
63 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
64
65 /** Encapsulates a Gyro component for the flight control system.
66
67 Syntax:
68
69 @code
70 <gyro name="name">
71   <lag> number </lag>
72   <noise variation="PERCENT|ABSOLUTE"> number </noise>
73   <quantization name="name">
74     <bits> number </bits>
75     <min> number </min>
76     <max> number </max>
77   </quantization>
78   <drift_rate> number </drift_rate>
79   <bias> number </bias>
80 </gyro>
81 @endcode
82
83 Example:
84
85 @code
86 <gyro name="aero/gyro/roll">
87   <axis> X </axis>
88   <lag> 0.5 </lag>
89   <noise variation="PERCENT"> 2 </noise>
90   <quantization name="aero/gyro/quantized/qbar">
91     <bits> 12 </bits>
92     <min> 0 </min>
93     <max> 400 </max>
94   </quantization>
95   <bias> 0.5 </bias>
96 </gyro>
97 @endcode
98
99 For noise, if the type is PERCENT, then the value supplied is understood to be a
100 percentage variance. That is, if the number given is 0.05, the the variance is
101 understood to be +/-0.05 percent maximum variance. So, the actual value for the gyro
102 will be *anywhere* from 0.95 to 1.05 of the actual "perfect" value at any time -
103 even varying all the way from 0.95 to 1.05 in adjacent frames - whatever the delta
104 time.
105
106 @author Jon S. Berndt
107 @version $Revision: 1.6 $
108 */
109
110 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
111 CLASS DECLARATION
112 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
113
114 class FGGyro  : public FGSensor, public FGSensorOrientation
115 {
116 public:
117   FGGyro(FGFCS* fcs, Element* element);
118   ~FGGyro();
119
120   bool Run (void);
121
122 private:
123   FGAccelerations* Accelerations;
124   FGColumnVector3 vAccel;
125   void CalculateTransformMatrix(void);
126   
127   void Debug(int from);
128 };
129 }
130 #endif