]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/models/FGFCS.h
Merge branch 'next' into durk-atc
[flightgear.git] / src / FDM / JSBSim / models / FGFCS.h
index 3868118ca6280fe9521f33b741dd1b57a5f1ffcb..6b97297d5ab0f6dba17052aa2f00d4d3dbc8ae27 100644 (file)
@@ -4,7 +4,7 @@
  Author:       Jon S. Berndt
  Date started: 12/12/98
 
- ------------- Copyright (C) 1999  Jon S. Berndt (jsb@hal-pc.org) -------------
+ ------------- Copyright (C) 1999  Jon S. Berndt (jon@jsbsim.org) -------------
 
  This program is free software; you can redistribute it and/or modify it under
  the terms of the GNU Lesser General Public License as published by the Free Software
@@ -38,28 +38,20 @@ SENTRY
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#ifdef FGFS
-#  include <simgear/compiler.h>
-#  ifdef SG_HAVE_STD_INCLUDES
-#    include <vector>
-#  else
-#    include <vector.h>
-#  endif
-#else
-#  include <vector>
-#endif
+#include <iosfwd>
+#include <vector>
 
 #include <string>
-#include <models/flight_control/FGFCSComponent.h>
-#include <models/FGModel.h>
-#include <models/FGLGear.h>
-#include <input_output/FGXMLFileRead.h>
+#include "models/flight_control/FGFCSComponent.h"
+#include "models/FGModel.h"
+#include "models/FGLGear.h"
+#include "input_output/FGXMLFileRead.h"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_FCS "$Id$"
+#define ID_FCS "$Id: FGFCS.h,v 1.35 2011/04/05 20:20:21 andgi Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -171,10 +163,12 @@ CLASS DOCUMENTATION
     @property fcs/spoiler-pos-deg
     @property fcs/spoiler-pos-norm
     @property fcs/mag-spoiler-pos-rad
+    @property fcs/wing-fold-pos-norm
     @property gear/gear-pos-norm
+    @property gear/tailhook-pos-norm
 
     @author Jon S. Berndt
-    @version $Revision$
+    @version $Revision: 1.35 $
     @see FGActuator
     @see FGDeadBand
     @see FGFCSFunction
@@ -213,31 +207,31 @@ public:
   //@{
   /** Gets the aileron command.
       @return aileron command in range from -1.0 - 1.0 */
-  inline double GetDaCmd(void) const { return DaCmd; }
+  double GetDaCmd(void) const { return DaCmd; }
 
   /** Gets the elevator command.
       @return elevator command in range from -1.0 - 1.0 */
-  inline double GetDeCmd(void) const { return DeCmd; }
+  double GetDeCmd(void) const { return DeCmd; }
 
   /** Gets the rudder command.
       @return rudder command in range from -1.0 - 1.0 */
-  inline double GetDrCmd(void) const { return DrCmd; }
+  double GetDrCmd(void) const { return DrCmd; }
 
   /** Gets the steering command.
       @return steering command in range from -1.0 - 1.0 */
-  inline double GetDsCmd(void) const { return DsCmd; }
+  double GetDsCmd(void) const { return DsCmd; }
 
   /** Gets the flaps command.
       @return flaps command in range from 0 to 1.0 */
-  inline double GetDfCmd(void) const { return DfCmd; }
+  double GetDfCmd(void) const { return DfCmd; }
 
   /** Gets the speedbrake command.
       @return speedbrake command in range from 0 to 1.0 */
-  inline double GetDsbCmd(void) const { return DsbCmd; }
+  double GetDsbCmd(void) const { return DsbCmd; }
 
   /** Gets the spoiler command.
       @return spoiler command in range from 0 to 1.0 */
-  inline double GetDspCmd(void) const { return DspCmd; }
+  double GetDspCmd(void) const { return DspCmd; }
 
   /** Gets the throttle command.
       @param engine engine ID number
@@ -247,73 +241,71 @@ public:
   /** Gets the mixture command.
       @param engine engine ID number
       @return mixture command in range from 0 - 1.0 for the given engine */
-  inline double GetMixtureCmd(int engine) const { return MixtureCmd[engine]; }
+  double GetMixtureCmd(int engine) const { return MixtureCmd[engine]; }
 
   /** Gets the prop pitch command.
       @param engine engine ID number
       @return pitch command in range from 0.0 - 1.0 for the given engine */
-  inline double GetPropAdvanceCmd(int engine) const { return PropAdvanceCmd[engine]; }
+  double GetPropAdvanceCmd(int engine) const { return PropAdvanceCmd[engine]; }
 
   /** Gets the prop feather command.
       @param engine engine ID number
       @return feather command for the given engine (on / off)*/
-  inline bool GetFeatherCmd(int engine) const { return PropFeatherCmd[engine]; }
+  bool GetFeatherCmd(int engine) const { return PropFeatherCmd[engine]; }
 
   /** Gets the pitch trim command.
       @return pitch trim command in range from -1.0 to 1.0 */
-  inline double GetPitchTrimCmd(void) const { return PTrimCmd; }
+  double GetPitchTrimCmd(void) const { return PTrimCmd; }
 
   /** Gets the rudder trim command.
       @return rudder trim command in range from -1.0 - 1.0 */
-  inline double GetYawTrimCmd(void) const { return YTrimCmd; }
+  double GetYawTrimCmd(void) const { return YTrimCmd; }
 
   /** Gets the aileron trim command.
       @return aileron trim command in range from -1.0 - 1.0 */
-  inline double GetRollTrimCmd(void) const { return RTrimCmd; }
+  double GetRollTrimCmd(void) const { return RTrimCmd; }
 
   /** Get the gear extend/retract command. 0 commands gear up, 1 down.
       defaults to down.
       @return the current value of the gear extend/retract command*/
-  inline double GetGearCmd(void) const { return GearCmd; }
+  double GetGearCmd(void) const { return GearCmd; }
   //@}
 
   /// @name Aerosurface position retrieval
   //@{
   /** Gets the left aileron position.
       @return aileron position in radians */
-  inline double GetDaLPos( int form = ofRad )
+  double GetDaLPos( int form = ofRad )
                          const { return DaLPos[form]; }
 
-  /// @name Aerosurface position retrieval
-  //@{
   /** Gets the right aileron position.
       @return aileron position in radians */
-  inline double GetDaRPos( int form = ofRad )
+  double GetDaRPos( int form = ofRad )
                          const { return DaRPos[form]; }
 
   /** Gets the elevator position.
       @return elevator position in radians */
-  inline double GetDePos( int form = ofRad )
+  double GetDePos( int form = ofRad )
                          const { return DePos[form]; }
 
   /** Gets the rudder position.
       @return rudder position in radians */
-  inline double GetDrPos( int form = ofRad )
+  double GetDrPos( int form = ofRad )
                          const { return DrPos[form]; }
 
   /** Gets the speedbrake position.
       @return speedbrake position in radians */
-  inline double GetDsbPos( int form = ofRad )
+  double GetDsbPos( int form = ofRad )
                          const { return DsbPos[form]; }
 
   /** Gets the spoiler position.
       @return spoiler position in radians */
-  inline double GetDspPos( int form = ofRad )
+  double GetDspPos( int form = ofRad )
                          const { return DspPos[form]; }
 
   /** Gets the flaps position.
       @return flaps position in radians */
-  inline double GetDfPos( int form = ofRad )
+  double GetDfPos( int form = ofRad )
                          const { return DfPos[form]; }
 
   /** Gets the throttle position.
@@ -324,7 +316,7 @@ public:
   /** Gets the mixture position.
       @param engine engine ID number
       @return mixture position for the given engine in range from 0 - 1.0 */
-  inline double GetMixturePos(int engine) const { return MixturePos[engine]; }
+  double GetMixturePos(int engine) const { return MixturePos[engine]; }
 
   /** Gets the steering position.
       @return steering position in degrees */
@@ -332,85 +324,88 @@ public:
 
   /** Gets the gear position (0 up, 1 down), defaults to down
       @return gear position (0 up, 1 down) */
-  inline double GetGearPos(void) const { return GearPos; }
+  double GetGearPos(void) const { return GearPos; }
+
+  /** Gets the tailhook position (0 up, 1 down)
+      @return tailhook position (0 up, 1 down) */
+  double GetTailhookPos(void) const { return TailhookPos; }
+
+  /** Gets the wing fold position (0 unfolded, 1 folded)
+      @return wing fold position (0 unfolded, 1 folded) */
+  double GetWingFoldPos(void) const { return WingFoldPos; }
 
   /** Gets the prop pitch position.
       @param engine engine ID number
       @return prop pitch position for the given engine in range from 0 - 1.0 */
-  inline double GetPropAdvance(int engine) const { return PropAdvance[engine]; }
+  double GetPropAdvance(int engine) const { return PropAdvance[engine]; }
 
   /** Gets the prop feather position.
       @param engine engine ID number
       @return prop fether for the given engine (on / off)*/
-  inline bool GetPropFeather(int engine) const { return PropFeather[engine]; }
+  bool GetPropFeather(int engine) const { return PropFeather[engine]; }
   //@}
 
-  /** Retrieves the State object pointer.
-      This is used by the FGFCS-owned components.
-      @return pointer to the State object */
-  inline FGState* GetState(void) { return State; }
-
   /** Retrieves all component names for inclusion in output stream
-      @param delimeter either a tab or comma string depending on output type
+      @param delimiter either a tab or comma string depending on output type
       @return a string containing the descriptive names for all components */
-  string GetComponentStrings(string delimeter);
+  std::string GetComponentStrings(const std::string& delimiter) const;
 
   /** Retrieves all component outputs for inclusion in output stream
-      @param delimeter either a tab or comma string depending on output type
+      @param delimiter either a tab or comma string depending on output type
       @return a string containing the numeric values for the current set of
       component outputs */
-  string GetComponentValues(string delimeter);
+  std::string GetComponentValues(const std::string& delimiter) const;
 
   /// @name Pilot input command setting
   //@{
   /** Sets the aileron command
       @param cmd aileron command */
-  inline void SetDaCmd( double cmd ) { DaCmd = cmd; }
+  void SetDaCmd( double cmd ) { DaCmd = cmd; }
 
   /** Sets the elevator command
       @param cmd elevator command in percent*/
-  inline void SetDeCmd(double cmd ) { DeCmd = cmd; }
+  void SetDeCmd(double cmd ) { DeCmd = cmd; }
 
   /** Sets the rudder command
       @param cmd rudder command in percent*/
-  inline void SetDrCmd(double cmd) { DrCmd = cmd; }
+  void SetDrCmd(double cmd) { DrCmd = cmd; }
 
   /** Sets the steering command
       @param cmd steering command in percent*/
-  inline void SetDsCmd(double cmd) { DsCmd = cmd; }
+  void SetDsCmd(double cmd) { DsCmd = cmd; }
 
   /** Sets the flaps command
       @param cmd flaps command in percent*/
-  inline void SetDfCmd(double cmd) { DfCmd = cmd; }
+  void SetDfCmd(double cmd) { DfCmd = cmd; }
 
   /** Sets the speedbrake command
       @param cmd speedbrake command in percent*/
-  inline void SetDsbCmd(double cmd) { DsbCmd = cmd; }
+  void SetDsbCmd(double cmd) { DsbCmd = cmd; }
 
   /** Sets the spoilers command
       @param cmd spoilers command in percent*/
-  inline void SetDspCmd(double cmd) { DspCmd = cmd; }
+  void SetDspCmd(double cmd) { DspCmd = cmd; }
 
   /** Sets the pitch trim command
       @param cmd pitch trim command in percent*/
-  inline void SetPitchTrimCmd(double cmd) { PTrimCmd = cmd; }
+  void SetPitchTrimCmd(double cmd) { PTrimCmd = cmd; }
 
   /** Sets the rudder trim command
       @param cmd rudder trim command in percent*/
-  inline void SetYawTrimCmd(double cmd) { YTrimCmd = cmd; }
+  void SetYawTrimCmd(double cmd) { YTrimCmd = cmd; }
 
   /** Sets the aileron trim command
       @param cmd aileron trim command in percent*/
-  inline void SetRollTrimCmd(double cmd) { RTrimCmd = cmd; }
+  void SetRollTrimCmd(double cmd) { RTrimCmd = cmd; }
 
   /** Sets the throttle command for the specified engine
       @param engine engine ID number
-      @param cmd throttle command in percent (0 - 100)*/
+      @param cmd normalized throttle command (0.0 - 1.0)*/
   void SetThrottleCmd(int engine, double cmd);
 
   /** Sets the mixture command for the specified engine
       @param engine engine ID number
-      @param cmd mixture command in percent (0 - 100)*/
+      @param cmd normalized mixture command (0.0 - 1.0)*/
   void SetMixtureCmd(int engine, double cmd);
 
   /** Set the gear extend/retract command, defaults to down
@@ -432,40 +427,40 @@ public:
   //@{
   /** Sets the left aileron position
       @param cmd left aileron position in radians*/
-  inline void SetDaLPos( int form , double pos );
+  void SetDaLPos( int form , double pos );
 
   /** Sets the right aileron position
       @param cmd right aileron position in radians*/
-  inline void SetDaRPos( int form , double pos );
+  void SetDaRPos( int form , double pos );
 
   /** Sets the elevator position
       @param cmd elevator position in radians*/
-  inline void SetDePos( int form , double pos );
+  void SetDePos( int form , double pos );
 
   /** Sets the rudder position
       @param cmd rudder position in radians*/
-  inline void SetDrPos( int form , double pos );
+  void SetDrPos( int form , double pos );
 
    /** Sets the flaps position
       @param cmd flaps position in radians*/
-  inline void SetDfPos( int form , double pos );
+  void SetDfPos( int form , double pos );
 
   /** Sets the speedbrake position
       @param cmd speedbrake position in radians*/
-  inline void SetDsbPos( int form , double pos );
+  void SetDsbPos( int form , double pos );
 
   /** Sets the spoiler position
       @param cmd spoiler position in radians*/
-  inline void SetDspPos( int form , double pos );
+  void SetDspPos( int form , double pos );
 
   /** Sets the actual throttle setting for the specified engine
       @param engine engine ID number
-      @param cmd throttle setting in percent (0 - 100)*/
+      @param cmd normalized throttle setting (0.0 - 1.0)*/
   void SetThrottlePos(int engine, double cmd);
 
   /** Sets the actual mixture setting for the specified engine
       @param engine engine ID number
-      @param cmd mixture setting in percent (0 - 100)*/
+      @param cmd normalized mixture setting (0.0 - 1.0)*/
   void SetMixturePos(int engine, double cmd);
 
   /** Sets the steering position
@@ -476,6 +471,13 @@ public:
       @param gear position 0 up, 1 down       */
    void SetGearPos(double gearpos) { GearPos = gearpos; }
 
+  /** Set the tailhook position
+      @param tailhook position 0 up, 1 down       */
+   void SetTailhookPos(double hookpos) { TailhookPos = hookpos; }
+
+  /** Set the wing fold position
+      @param wing fold position 0 unfolded, 1 folded  */
+   void SetWingFoldPos(double foldpos) { WingFoldPos = foldpos; }
 
   /** Sets the actual prop pitch setting for the specified engine
       @param engine engine ID number
@@ -529,8 +531,8 @@ public:
       @return true if succesful */
   bool Load(Element* el, SystemType systype);
 
-  ifstream* FindSystemFile(string system_filename);
-  string FindSystemFullPathname(string system_filename);
+  std::ifstream* FindSystemFile(const std::string& system_filename);
+  std::string FindSystemFullPathname(const std::string& system_filename);
 
   void AddThrottle(void);
   void AddGear(void);
@@ -538,29 +540,30 @@ public:
 
   FGPropertyManager* GetPropertyManager(void) { return PropertyManager; }
 
+  bool GetTrimStatus(void) const { return FDMExec->GetTrimStatus(); }
+
 private:
   double DaCmd, DeCmd, DrCmd, DsCmd, DfCmd, DsbCmd, DspCmd;
   double DePos[NForms], DaLPos[NForms], DaRPos[NForms], DrPos[NForms];
   double DfPos[NForms], DsbPos[NForms], DspPos[NForms];
   double PTrimCmd, YTrimCmd, RTrimCmd;
-  vector <double> ThrottleCmd;
-  vector <double> ThrottlePos;
-  vector <double> MixtureCmd;
-  vector <double> MixturePos;
-  vector <double> PropAdvanceCmd;
-  vector <double> PropAdvance;
-  vector <bool> PropFeatherCmd;
-  vector <bool> PropFeather;
-  vector <double> SteerPosDeg;
+  std::vector <double> ThrottleCmd;
+  std::vector <double> ThrottlePos;
+  std::vector <double> MixtureCmd;
+  std::vector <double> MixturePos;
+  std::vector <double> PropAdvanceCmd;
+  std::vector <double> PropAdvance;
+  std::vector <bool> PropFeatherCmd;
+  std::vector <bool> PropFeather;
+  std::vector <double> SteerPosDeg;
   double LeftBrake, RightBrake, CenterBrake; // Brake settings
   double GearCmd,GearPos;
+  double TailhookPos, WingFoldPos;
 
-  typedef vector <FGFCSComponent*> FCSCompVec;
+  typedef std::vector <FGFCSComponent*> FCSCompVec;
   FCSCompVec Systems;
   FCSCompVec FCSComponents;
   FCSCompVec APComponents;
-  FCSCompVec sensors;
-  vector <double*> interface_properties;
   void bind(void);
   void bindModel(void);
   void bindThrottle(unsigned int);