]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/FGFCS.h
Encapsulate the interpolstion version of FGEnvironment and fix some bugs
[flightgear.git] / src / FDM / JSBSim / FGFCS.h
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3  Header:       FGGFCS.h
4  Author:       Jon S. Berndt
5  Date started: 12/12/98
6  
7  ------------- Copyright (C) 1999  Jon S. Berndt (jsb@hal-pc.org) -------------
8  
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
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 General Public License for more
17  details.
18  
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.
22  
23  Further information about the GNU General Public License can also be found on
24  the world wide web at http://www.gnu.org.
25  
26 HISTORY
27 --------------------------------------------------------------------------------
28 12/12/98   JSB   Created
29  
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31 SENTRY
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
33
34 #ifndef FGFCS_H
35 #define FGFCS_H
36
37 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38 INCLUDES
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
40
41 #ifdef FGFS
42 #  include <simgear/compiler.h>
43 #  ifdef SG_HAVE_STD_INCLUDES
44 #    include <vector>
45 #  else
46 #    include <vector.h>
47 #  endif
48 #else
49 #  include <vector>
50 #endif
51
52 #include <string>
53 #include "filtersjb/FGFCSComponent.h"
54 #include "FGModel.h"
55 #include "FGLGear.h"
56 #include "FGConfigFile.h"
57
58 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
59 DEFINITIONS
60 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
61
62 #define ID_FCS "$Id$"
63
64 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
65 FORWARD DECLARATIONS
66 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
67
68 namespace JSBSim {
69
70 typedef enum { iDe=0, iDaL, iDaR, iDr, iDsb, iDsp, iDf, NNorm } FcIdx;
71 typedef enum { ofRad=0, ofNorm, ofMag , NForms} OutputForm;
72
73 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
74 CLASS DOCUMENTATION
75 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
76
77 /** Encapsulates the Flight Control System (FCS) functionality.
78     This class owns and contains the list of FGFCSComponents
79     that define the control system for this aircraft. The config file for the
80     aircraft contains a description of the control path that starts at an input
81     or command and ends at an effector, e.g. an aerosurface. The FCS components
82     which comprise the control laws for an axis are defined sequentially in
83     the configuration file. For instance, for the X-15:
84     
85     <pre>
86     &lt FLIGHT_CONTROL NAME="X-15 SAS"&gt
87
88     &lt COMPONENT NAME="Pitch Trim Sum" TYPE="SUMMER"&gt
89       ID            0
90       INPUT        FG_ELEVATOR_CMD
91       INPUT        FG_PITCH_TRIM_CMD
92       CLIPTO       -1 1
93     &lt/COMPONENT&gt
94
95     &lt COMPONENT NAME="Pitch Command Scale" TYPE="AEROSURFACE_SCALE"&gt
96       ID           1
97       INPUT        0
98       MIN         -50
99       MAX          50
100     &lt/COMPONENT&gt
101
102     &lt COMPONENT NAME="Pitch Gain 1" TYPE="PURE_GAIN"&gt
103       ID           2
104       INPUT        1
105       GAIN         -0.36
106     &lt/COMPONENT&gt
107
108     &lt COMPONENT NAME="Pitch Scheduled Gain 1" TYPE="SCHEDULED_GAIN"&gt
109       ID           3
110       INPUT        2
111       GAIN         0.017
112       SCHEDULED_BY FG_ELEVATOR_POS
113       -0.35  -6.0
114       -0.17  -3.0
115        0.00  -2.0
116        0.09  -3.0
117        0.17  -5.0
118        0.60 -12.0
119     &lt/COMPONENT&gt
120
121     ... etc.
122     </pre>
123     
124     In the above case we can see the first few components of the pitch channel
125     defined. The input to the first component, as can be seen in the "Pitch trim
126     sum" component, is really the sum of two parameters: elevator command (from
127     the stick - a pilot input), and pitch trim. The type of this component is
128     "Summer". Its ID is 0 - the ID is used by other components to reference it.
129     The next component created is an aerosurface scale component - a type of
130     gain (see the LoadFCS() method for insight on how the various types of
131     components map into the actual component classes). You can see the input of
132     the "Pitch Command Scale" component takes "0" as input. When a number is
133     specified as an input, it refers to the ID of another FCS component. In this
134     case, ID 0 refers to the previously defined and discussed "Pitch Trim Sum"
135     component. This continues until the final component for an axis when the
136     OUTPUT keyword specifies where the output is supposed to go. See the
137     individual components for more information on how they are mechanized.
138     
139     @author Jon S. Berndt
140     @version $Id$
141     @see FGFCSComponent
142     @see FGConfigFile
143     @see FGGain
144     @see FGSummer
145     @see FGSwitch
146     @see FGGradient
147     @see FGFilter
148     @see FGDeadBand
149 */
150
151 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
152 CLASS DECLARATION
153 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
154
155 class FGFCS : public FGModel {
156
157 public:
158   /** Constructor
159       @param Executive a pointer to the parent executive object */
160   FGFCS(FGFDMExec*);
161   /// Destructor
162   ~FGFCS();
163
164   /** Runs the Flight Controls model; called by the Executive
165       @return false if no error */
166   bool Run(void);
167
168   /// @name Pilot input command retrieval
169   //@{
170   /** Gets the aileron command.
171       @return aileron command in percent */
172   inline double GetDaCmd(void) const { return DaCmd; }
173   
174   /** Gets the elevator command.
175       @return elevator command in percent */
176   inline double GetDeCmd(void) const { return DeCmd; }
177
178   /** Gets the rudder command.
179       @return rudder command in percent */
180   inline double GetDrCmd(void) const { return DrCmd; }
181
182   /** Gets the flaps command.
183       @return flaps command in percent */
184   inline double GetDfCmd(void) const { return DfCmd; }
185
186   /** Gets the speedbrake command.
187       @return speedbrake command in percent */
188   inline double GetDsbCmd(void) const { return DsbCmd; }
189
190   /** Gets the spoiler command.
191       @return spoiler command in percent */
192   inline double GetDspCmd(void) const { return DspCmd; }
193
194   /** Gets the throttle command.
195       @param engine engine ID number
196       @return throttle command in percent ( 0 - 100) for the given engine */
197   double GetThrottleCmd(int engine) const;
198
199   /** Gets the mixture command.
200       @param engine engine ID number
201       @return mixture command in percent ( 0 - 100) for the given engine */
202   inline double GetMixtureCmd(int engine) const { return MixtureCmd[engine]; }
203
204   /** Gets the prop pitch command.
205       @param engine engine ID number
206       @return pitch command in percent ( 0.0 - 1.0) for the given engine */
207   inline double GetPropAdvanceCmd(int engine) const { return PropAdvanceCmd[engine]; }
208
209   /** Gets the pitch trim command.
210       @return pitch trim command in percent */
211   inline double GetPitchTrimCmd(void) const { return PTrimCmd; }
212   
213   /** Gets the rudder trim command.
214       @return rudder trim command in percent */
215   inline double GetYawTrimCmd(void) const { return YTrimCmd; }
216   
217   /** Gets the aileron trim command.
218       @return aileron trim command in percent */
219   inline double GetRollTrimCmd(void) const { return RTrimCmd; }
220   
221   /** Get the gear extend/retract command. 0 commands gear up, 1 down.
222       defaults to down.
223       @return the current value of the gear extend/retract command*/
224   inline double GetGearCmd(void) const { return GearCmd; }    
225   //@}
226
227   /// @name AUTOPilot -> FCS effectors command retrieval
228   //@{
229   /** Gets the AUTOPilot aileron command.
230       @return aileron command in radians */
231   inline double GetAPDaCmd(void) const { return AP_DaCmd; }
232   
233   /** Gets the AUTOPilot elevator command.
234       @return elevator command in radians */
235   inline double GetAPDeCmd(void) const { return AP_DeCmd; }
236
237   /** Gets the AUTOPilot rudder command.
238       @return rudder command in radians */
239   inline double GetAPDrCmd(void) const { return AP_DrCmd; }
240   
241   /** Gets the AUTOPilot throttle (all engines) command.
242       @return throttle command in percent */
243   inline double GetAPThrottleCmd(void) const { return AP_ThrottleCmd; }
244   //@}
245
246   /// @name AUTOPilot setpoint retrieval
247   //@{
248   /** Gets the autopilot pitch attitude setpoint
249       @return Pitch attitude setpoint in radians */
250   inline double GetAPAttitudeSetPt(void) const {return APAttitudeSetPt;}
251
252   /** Gets the autopilot altitude setpoint
253       @return Altitude setpoint in feet */
254   inline double GetAPAltitudeSetPt(void) const {return APAltitudeSetPt;}
255
256   /** Gets the autopilot heading setpoint
257       @return Heading setpoint in radians */
258   inline double GetAPHeadingSetPt(void) const {return APHeadingSetPt;}
259
260   /** Gets the autopilot airspeed setpoint
261       @return Airspeed setpoint in fps */
262   inline double GetAPAirspeedSetPt(void) const {return APAirspeedSetPt;}
263   //@}
264
265   /// @name AUTOPilot setpoint setting
266   //@{
267   /// Sets the autopilot pitch attitude setpoint
268   inline void SetAPAttitudeSetPt(double set) {APAttitudeSetPt = set;}
269
270   /// Sets the autopilot altitude setpoint
271   inline void SetAPAltitudeSetPt(double set) {APAltitudeSetPt = set;}
272
273   /// Sets the autopilot heading setpoint
274   inline void SetAPHeadingSetPt(double set) {APHeadingSetPt = set;}
275
276   /// Sets the autopilot airspeed setpoint
277   inline void SetAPAirspeedSetPt(double set) {APAirspeedSetPt = set;}
278   //@}
279
280
281     /// @name AUTOPilot mode setting
282   //@{
283   /** Turns on/off the attitude-seeking autopilot.
284       @param set true turns the mode on, false turns it off  **/
285   inline void SetAPAcquireAttitude(bool set) {APAcquireAttitude = set;}
286   
287   /** Turns on/off the altitude-seeking autopilot.
288       @param set true turns the mode on, false turns it off  **/
289   inline void SetAPAcquireAltitude(bool set) {APAcquireAltitude = set;}
290   
291   /** Turns on/off the heading-seeking autopilot.
292       @param set true turns the mode on, false turns it off  **/
293   inline void SetAPAcquireHeading(bool set) {APAcquireHeading = set;}
294   
295   /** Turns on/off the airspeed-seeking autopilot.
296       @param set true turns the mode on, false turns it off  **/
297   inline void SetAPAcquireAirspeed(bool set) {APAcquireAirspeed = set;}
298   
299   /** Turns on/off the attitude-holding autopilot.
300       @param set true turns the mode on, false turns it off  **/
301   inline void SetAPAttitudeHold(bool set) {APAttitudeHold = set;}
302
303   /** Turns on/off the altitude-holding autopilot.
304       @param set true turns the mode on, false turns it off  **/
305   inline void SetAPAltitudeHold(bool set) {APAltitudeHold = set;}
306
307   /** Turns on/off the heading-holding autopilot.
308       @param set true turns the mode on, false turns it off  **/
309   inline void SetAPHeadingHold(bool set) {APHeadingHold = set;}
310
311   /** Turns on/off the airspeed-holding autopilot.
312       @param set true turns the mode on, false turns it off  **/
313   inline void SetAPAirspeedHold(bool set) {APAirspeedHold = set;}
314
315   /** Turns on/off the wing-leveler autopilot.
316       @param set true turns the mode on, false turns it off  **/
317   inline void SetAPWingsLevelHold(bool set) {APWingsLevelHold = set;}
318   //@}
319   
320   /// @name AUTOPilot mode retrieval
321   //@{
322   /** Retrieves the on/off mode of the autopilot AcquireAttitude mode
323       @return true if on, false if off */
324   inline bool GetAPAcquireAttitude(void) const {return APAcquireAttitude;}
325
326   /** Retrieves the on/off mode of the autopilot AcquireAltitude mode
327       @return true if on, false if off */
328   inline bool GetAPAcquireAltitude(void) const {return APAcquireAltitude;}
329
330   /** Retrieves the on/off mode of the autopilot AcquireHeading mode
331       @return true if on, false if off */
332   inline bool GetAPAcquireHeading(void) const {return APAcquireHeading;}
333
334   /** Retrieves the on/off mode of the autopilot AcquireAirspeed mode
335       @return true if on, false if off */
336   inline bool GetAPAcquireAirspeed(void) const {return APAcquireAirspeed;}
337
338   /** Retrieves the on/off mode of the autopilot AttitudeHold mode
339       @return true if on, false if off */
340   inline bool GetAPAttitudeHold(void) const {return APAttitudeHold;}
341
342   /** Retrieves the on/off mode of the autopilot AltitudeHold mode
343       @return true if on, false if off */
344   inline bool GetAPAltitudeHold(void) const {return APAltitudeHold;}
345
346   /** Retrieves the on/off mode of the autopilot HeadingHold mode
347       @return true if on, false if off */
348   inline bool GetAPHeadingHold(void) const {return APHeadingHold;}
349
350   /** Retrieves the on/off mode of the autopilot AirspeedHold mode
351       @return true if on, false if off */
352   inline bool GetAPAirspeedHold(void) const {return APAirspeedHold;}
353
354   /** Retrieves the on/off mode of the autopilot WingsLevelHold mode
355       @return true if on, false if off */
356   inline bool GetAPWingsLevelHold(void) const {return APWingsLevelHold;}
357   //@}
358
359   /// @name Aerosurface position retrieval
360   //@{
361   /** Gets the left aileron position.
362       @return aileron position in radians */
363   inline double GetDaLPos( int form = ofRad ) 
364                          const { return DaLPos[form]; }
365
366   /// @name Aerosurface position retrieval
367   //@{
368   /** Gets the right aileron position.
369       @return aileron position in radians */
370   inline double GetDaRPos( int form = ofRad ) 
371                          const { return DaRPos[form]; }
372
373   /** Gets the elevator position.
374       @return elevator position in radians */
375   inline double GetDePos( int form = ofRad ) 
376                          const { return DePos[form]; }
377  
378   /** Gets the rudder position.
379       @return rudder position in radians */
380   inline double GetDrPos( int form = ofRad ) 
381                          const { return DrPos[form]; }
382
383   /** Gets the speedbrake position.
384       @return speedbrake position in radians */
385   inline double GetDsbPos( int form = ofRad ) 
386                          const { return DsbPos[form]; }
387
388   /** Gets the spoiler position.
389       @return spoiler position in radians */
390   inline double GetDspPos( int form = ofRad ) 
391                          const { return DspPos[form]; }
392   
393   /** Gets the flaps position.
394       @return flaps position in radians */
395   inline double GetDfPos( int form = ofRad ) 
396                          const { return DfPos[form]; }
397                          
398   /** Gets the throttle position.
399       @param engine engine ID number
400       @return throttle position for the given engine in percent ( 0 - 100)*/
401   double GetThrottlePos(int engine) const;
402
403   /** Gets the mixture position.
404       @param engine engine ID number
405       @return mixture position for the given engine in percent ( 0 - 100)*/
406   inline double GetMixturePos(int engine) const { return MixturePos[engine]; }
407   
408   /** Gets the gear position (0 up, 1 down), defaults to down
409       @return gear position (0 up, 1 down) */
410   inline double GetGearPos(void) const { return GearPos; }    
411
412   /** Gets the prop pitch position.
413       @param engine engine ID number
414       @return prop pitch position for the given engine in percent ( 0.0-1.0)*/
415   inline double GetPropAdvance(int engine) const { return PropAdvance[engine]; }
416   //@}
417
418   /** Retrieves the State object pointer.
419       This is used by the FGFCS-owned components.
420       @return pointer to the State object */
421   inline FGState* GetState(void) { return State; }
422
423   /** Retrieves a components output value
424       @param idx the index of the component (the component ID)
425       @return output value from the component */
426   double GetComponentOutput(int idx);
427
428   /** Retrieves the component name
429       @param idx the index of the component (the component ID)
430       @return name of the component */
431   string GetComponentName(int idx);
432
433   /** Retrieves all component names for inclusion in output stream */
434   string GetComponentStrings(void);
435
436   /** Retrieves all component outputs for inclusion in output stream */
437   string GetComponentValues(void);
438
439   /// @name Pilot input command setting
440   //@{
441   /** Sets the aileron command
442       @param cmd aileron command in percent*/
443   inline void SetDaCmd( double cmd ) { DaCmd = cmd; }
444
445   /** Sets the elevator command
446       @param cmd elevator command in percent*/
447   inline void SetDeCmd(double cmd ) { DeCmd = cmd; }
448
449   /** Sets the rudder command
450       @param cmd rudder command in percent*/
451   inline void SetDrCmd(double cmd) { DrCmd = cmd; }
452
453   /** Sets the flaps command
454       @param cmd flaps command in percent*/
455   inline void SetDfCmd(double cmd) { DfCmd = cmd; }
456
457   /** Sets the speedbrake command
458       @param cmd speedbrake command in percent*/
459   inline void SetDsbCmd(double cmd) { DsbCmd = cmd; }
460
461   /** Sets the spoilers command
462       @param cmd spoilers command in percent*/
463   inline void SetDspCmd(double cmd) { DspCmd = cmd; }
464
465   /** Sets the pitch trim command
466       @param cmd pitch trim command in percent*/
467   inline void SetPitchTrimCmd(double cmd) { PTrimCmd = cmd; }
468
469   /** Sets the rudder trim command
470       @param cmd rudder trim command in percent*/
471   inline void SetYawTrimCmd(double cmd) { YTrimCmd = cmd; }
472
473   /** Sets the aileron trim command
474       @param cmd aileron trim command in percent*/
475   inline void SetRollTrimCmd(double cmd) { RTrimCmd = cmd; }
476
477   /** Sets the throttle command for the specified engine
478       @param engine engine ID number
479       @param cmd throttle command in percent (0 - 100)*/
480   void SetThrottleCmd(int engine, double cmd);
481
482   /** Sets the mixture command for the specified engine
483       @param engine engine ID number
484       @param cmd mixture command in percent (0 - 100)*/
485   void SetMixtureCmd(int engine, double cmd);
486   
487   /** Set the gear extend/retract command, defaults to down
488       @param gear command 0 for up, 1 for down */
489    void SetGearCmd(double gearcmd) { GearCmd = gearcmd; }   
490
491   /** Sets the propeller pitch command for the specified engine
492       @param engine engine ID number
493       @param cmd mixture command in percent (0.0 - 1.0)*/
494   void SetPropAdvanceCmd(int engine, double cmd);
495   //@}
496
497   /// @name AUTOPilot -> FCS effector command setting
498   //@{
499   /** Sets the AUTOPilot aileron command
500       @param cmd AUTOPilot aileron command in radians*/
501   inline void SetAPDaCmd( double cmd ) { AP_DaCmd = cmd; }
502
503   /** Sets the AUTOPilot elevator command
504       @param cmd AUTOPilot elevator command in radians*/
505   inline void SetAPDeCmd(double cmd ) { AP_DeCmd = cmd; }
506
507   /** Sets the AUTOPilot rudder command
508       @param cmd AUTOPilot rudder command in radians*/
509   inline void SetAPDrCmd(double cmd) { AP_DrCmd = cmd; }
510
511   /** Sets the AUTOPilot throttle command
512       @param cmd AUTOPilot throttle command in percent*/
513   inline void SetAPThrottleCmd(double cmd) { AP_ThrottleCmd = cmd; }
514   //@}
515
516   /// @name Aerosurface position setting
517   //@{
518   /** Sets the left aileron position
519       @param cmd left aileron position in radians*/
520   inline void SetDaLPos( int form , double pos ) 
521                                       { DaLPos[form] = pos; }
522
523   /** Sets the right aileron position
524       @param cmd right aileron position in radians*/
525   inline void SetDaRPos( int form , double pos ) 
526                                       { DaRPos[form] = pos; }
527
528   /** Sets the elevator position
529       @param cmd elevator position in radians*/
530   inline void SetDePos( int form , double pos ) 
531                                       { DePos[form] = pos; }
532
533   /** Sets the rudder position
534       @param cmd rudder position in radians*/
535   inline void SetDrPos( int form , double pos ) 
536                                       { DrPos[form] = pos; }
537  
538    /** Sets the flaps position
539       @param cmd flaps position in radians*/
540   inline void SetDfPos( int form , double pos ) 
541                                       { DfPos[form] = pos; }
542   
543   /** Sets the speedbrake position
544       @param cmd speedbrake position in radians*/
545   inline void SetDsbPos( int form , double pos ) 
546                                       { DsbPos[form] = pos; }
547
548   /** Sets the spoiler position
549       @param cmd spoiler position in radians*/
550   inline void SetDspPos( int form , double pos ) 
551                                       { DspPos[form] = pos; }
552  
553   /** Sets the actual throttle setting for the specified engine
554       @param engine engine ID number
555       @param cmd throttle setting in percent (0 - 100)*/
556   void SetThrottlePos(int engine, double cmd);
557
558   /** Sets the actual mixture setting for the specified engine
559       @param engine engine ID number
560       @param cmd mixture setting in percent (0 - 100)*/
561   void SetMixturePos(int engine, double cmd);
562   
563   /** Set the gear extend/retract position, defaults to down
564       @param gear position 0 up, 1 down       */
565    void SetGearPos(double gearpos) { GearPos = gearpos; }   
566
567
568   /** Sets the actual prop pitch setting for the specified engine
569       @param engine engine ID number
570       @param cmd prop pitch setting in percent (0.0 - 1.0)*/
571   void SetPropAdvance(int engine, double cmd);
572   //@}
573
574     /// @name Landing Gear brakes
575   //@{
576   /** Sets the left brake group
577       @param cmd brake setting in percent (0.0 - 1.0) */
578   void SetLBrake(double cmd) {LeftBrake = cmd;}
579
580   /** Sets the right brake group
581       @param cmd brake setting in percent (0.0 - 1.0) */
582   void SetRBrake(double cmd) {RightBrake = cmd;}
583
584   /** Sets the center brake group
585       @param cmd brake setting in percent (0.0 - 1.0) */
586   void SetCBrake(double cmd) {CenterBrake = cmd;}
587
588   /** Gets the brake for a specified group.
589       @param bg which brakegroup to retrieve the command for
590       @return the brake setting for the supplied brake group argument */
591   double GetBrake(FGLGear::BrakeGroup bg);
592   //@}
593
594   /** Loads the Flight Control System.
595       The FGAircraft instance is actually responsible for reading the config file
596       and calling the various Loadxx() methods of the other systems, passing in
597       the config file instance pointer. LoadFCS() is called from FGAircraft.
598       @param AC_cfg pointer to the config file instance
599       @return true if succesful */
600   bool Load(FGConfigFile* AC_cfg);
601
602   void AddThrottle(void);
603   
604   FGPropertyManager* GetPropertyManager(void) { return PropertyManager; }
605   
606   void bind(void);
607   void bindModel(void);
608   void unbind(FGPropertyManager *node);
609   
610 private:
611   double DaCmd, DeCmd, DrCmd, DfCmd, DsbCmd, DspCmd;
612   double AP_DaCmd, AP_DeCmd, AP_DrCmd, AP_ThrottleCmd;
613   double DePos[NForms], DaLPos[NForms], DaRPos[NForms], DrPos[NForms];  
614   double DfPos[NForms], DsbPos[NForms], DspPos[NForms];
615   double PTrimCmd, YTrimCmd, RTrimCmd;
616   vector <double> ThrottleCmd;
617   vector <double> ThrottlePos;
618   vector <double> MixtureCmd;
619   vector <double> MixturePos;
620   vector <double> PropAdvanceCmd;
621   vector <double> PropAdvance;
622   double LeftBrake, RightBrake, CenterBrake; // Brake settings
623   double GearCmd,GearPos;
624
625   enum Mode {mAP, mFCS, mNone} eMode;
626
627   double APAttitudeSetPt, APAltitudeSetPt, APHeadingSetPt, APAirspeedSetPt;
628   bool APAcquireAttitude, APAcquireAltitude, APAcquireHeading, APAcquireAirspeed;
629   bool APAttitudeHold, APAltitudeHold, APHeadingHold, APAirspeedHold, APWingsLevelHold;
630
631   bool DoNormalize;
632   void Normalize(void);
633
634   vector <FGFCSComponent*> FCSComponents;
635   vector <FGFCSComponent*> APComponents;
636   int ToNormalize[NNorm];
637   void Debug(int from);
638 };
639 }
640
641 #endif
642