]> git.mxchange.org Git - flightgear.git/blob - src/Autopilot/autobrake.hxx
Merge branch 'jmt/gpswidget'
[flightgear.git] / src / Autopilot / autobrake.hxx
1 // autobrake.hxx - generic, configurable autobrake system
2 //
3 // Written by James Turner, started September 2009.
4 //
5 // Copyright (C) 2009  Curtis L. Olson
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20 //
21 // $Id$
22
23 #ifndef FG_INSTR_AUTOBRAKE_HXX
24 #define FG_INSTR_AUTOBRAKE_HXX
25
26 #include <simgear/props/props.hxx>
27 #include <simgear/structure/subsystem_mgr.hxx>
28
29 // forward decls
30
31 class FGAutoBrake : public SGSubsystem
32 {
33 public:
34   FGAutoBrake();
35   virtual ~FGAutoBrake();
36
37   virtual void init ();
38   virtual void postinit ();
39   virtual void bind ();
40   virtual void unbind ();
41   virtual void update (double dt);
42     
43 private:
44   
45   void engage();
46   void disengage();
47   
48   void updateEngaged(double dt);
49   
50   bool shouldEngage();
51   bool shouldEngageRTO();
52   
53   /**
54    * Helper to determine if all throttles are at idle
55    * (or have reverse thrust engaged)
56    */
57   bool throttlesAtIdle() const;
58   
59   /**
60    * Helper to determine if we're airbone, i.e weight off all wheels
61    */
62   bool airborne() const;
63   
64 // accessors, mostly for SGRawValueMethods use
65   void setArmed(bool aArmed);
66   bool getArmed() const { return _armed; }
67   
68   void setRTO(bool aRTO);
69   bool getRTO() const { return _rto; }
70   
71   void setStep(int aStep);
72   int getStep() const { return _step; }
73   
74   bool getEngaged() const { return _engaged;}
75   double getTargetDecel() const { return _targetDecel; }
76   double getActualDecel() const { return _actualDecel; }
77
78 // members
79   double _lastGroundspeedKts;
80   int _step;
81   bool _rto; // true if in Rejected TakeOff mode
82   bool _armed;
83   bool _rtoArmed; ///< true if we have met arming criteria for RTO mode
84   bool _engaged; ///< true if auto-braking is currently active
85   double _targetDecel; // target deceleration ft-sec^2
86   double _actualDecel; // measured current deceleration in ft-sec^2
87   double _fcsBrakeControl;
88   bool _lastWoW;
89   double _leftBrakeInput; // summed pilot and co-pilot left brake input
90   double _rightBrakeInput; // summed pilot and co-pilot right brake input
91   double _leftBrakeOutput;
92   double _rightBrakeOutput;
93     
94   SGPropertyNode_ptr _root;
95   SGPropertyNode_ptr _brakeInputs[4];
96   SGPropertyNode_ptr _weightOnWheelsNode;
97   SGPropertyNode_ptr _engineControlsNode;
98   SGPropertyNode_ptr _groundspeedNode;
99   
100   int _configNumSteps;
101   int _configRTOStep;
102   int _configDisengageStep;
103   double _configMaxDecel; ///< deceleration (in ft-sec^2) corresponding to step=numSteps
104   double _configRTODecel; ///< deceleration (in ft-sec^2) to use in RTO mode
105   double _configRTOSpeed; ///< speed (in kts) for RTO mode to arm
106 };
107
108 #endif // of FG_INSTR_AUTOBRAKE_HXX