]> git.mxchange.org Git - flightgear.git/blob - src/Autopilot/autobrake.hxx
A generic, configurable autobrake system. Not fully features yet, but works quite...
[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();
58   
59 // accessors, mostly for SGRawValueMethods use
60   void setArmed(bool aArmed);
61   bool getArmed() const { return _armed; }
62   
63   void setRTO(bool aRTO);
64   bool getRTO() const { return _rto; }
65   
66   void setStep(int aStep);
67   int getStep() const { return _step; }
68   
69   bool getEngaged() const { return _engaged;}
70   double getTargetDecel() const { return _targetDecel; }
71   double getActualDecel() const { return _actualDecel; }
72
73 // members
74   double _lastGroundspeedKts;
75   int _step;
76   bool _rto; // true if in Rejected TakeOff mode
77   bool _armed;
78   bool _rtoArmed; ///< true if we have met arming criteria for RTO mode
79   bool _engaged; ///< true if auto-braking is currently active
80   double _targetDecel; // target deceleration ft-sec^2
81   double _actualDecel; // measured current deceleration in ft-sec^2
82   double _fcsBrakeControl;
83   bool _lastWoW;
84   double _leftBrakeInput; // summed pilot and co-pilot left brake input
85   double _rightBrakeInput; // summed pilot and co-pilot right brake input
86   double _leftBrakeOutput;
87   double _rightBrakeOutput;
88     
89   SGPropertyNode_ptr _root;
90   SGPropertyNode* _brakeInputs[4];
91   SGPropertyNode_ptr _weightOnWheelsNode;
92   SGPropertyNode_ptr _engineControlsNode;
93   SGPropertyNode_ptr _groundspeedNode;
94   
95   int _configNumSteps;
96   int _configRTOStep;
97   double _configMaxDecel; ///< deceleration (in ft-sec^2) corresponding to step=numSteps
98   double _configRTODecel; ///< deceleration (in ft-sec^2) to use in RTO mode
99   double _configRTOSpeed; ///< speed (in kts) for RTO mode to arm
100 };
101
102 #endif // of FG_INSTR_AUTOBRAKE_HXX