]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/models/flight_control/FGKinemat.h
Merge branch 'ehofman/sky'
[flightgear.git] / src / FDM / JSBSim / models / flight_control / FGKinemat.h
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3  Header:       FGKinemat.h
4  Author:       Tony Peden, for flight control system authored by Jon S. Berndt
5  Date started: 12/02/01
6
7  ------------- Copyright (C) Anthony K. Peden -------------
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 FGKinemat_H
34 #define FGKinemat_H
35
36 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
37 INCLUDES
38 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
39
40 #include "FGFCSComponent.h"
41 #include <vector>
42
43 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
44 DEFINITIONS
45 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
46
47 #define ID_FLAPS "$Id$"
48
49 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
50 FORWARD DECLARATIONS
51 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
52
53 namespace JSBSim {
54
55 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
56 CLASS DOCUMENTATION
57 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
58
59 /** Encapsulates a kinematic (mechanical) component for the flight control system.
60 This component models the action of a moving effector, such as an aerosurface or
61 other mechanized entity such as a landing gear strut for the purpose of effecting
62 vehicle control or configuration. The form of the component specification is:
63
64 @code
65 <kinematic name="Gear Control">
66   <input> [-]property </input>
67   <traverse>
68     <setting>
69       <position> number </position>
70       <time> number </time>
71     </setting>
72     ...
73   </traverse>
74   [<clipto>
75     <min> {[-]property name | value} </min>
76     <max> {[-]property name | value} </max>
77   </clipto>]
78   [<gain> {property name | value} </gain>]
79   [<output> {property} </output>]
80 </kinematic>
81 @endcode
82
83 The detent is the position that the component takes, and the lag is the time it
84 takes to get to that position from an adjacent setting. For example:
85
86 @code
87 <kinematic name="Gear Control">
88   <input>gear/gear-cmd-norm</input>
89   <traverse>
90     <setting>
91       <position>0</position>
92       <time>0</time>
93     </setting>
94     <setting>
95       <position>1</position>
96       <time>5</time>
97     </setting>
98   </traverse>
99   <output>gear/gear-pos-norm</output>
100 </kinematic>
101 @endcode
102
103 In this case, it takes 5 seconds to get to a 1 setting. As this is a software
104 mechanization of a servo-actuator, there should be an output specified.
105   */
106
107 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
108 CLASS DECLARATION
109 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
110
111 class FGKinemat  : public FGFCSComponent {
112 public:
113   /** Constructor.
114       @param fcs A reference to the current flight control system.
115       @param element reference to the current configuration file node.
116    */
117   FGKinemat(FGFCS* fcs, Element* element);
118
119   /// Destructor.
120   ~FGKinemat();
121
122   /** Kinematic component output value.
123       @return the current output of the kinematic object on the range of [0,1]. */
124   double GetOutputPct() const { return OutputPct; }
125
126   /** Run method, overrides FGModel::Run().
127       @return false on success, true on failure.
128       The routine doing the work.  */
129   bool Run (void);
130
131 private:
132   std::vector<double> Detents;
133   std::vector<double> TransitionTimes;
134   int NumDetents;
135   double OutputPct;
136   bool  DoScale;
137
138   void Debug(int from);
139 };
140 }
141 #endif