fgfcs.h
来自「6 DOF Missle Simulation」· C头文件 代码 · 共 582 行 · 第 1/2 页
H
582 行
/** Gets the rudder position. @return rudder position in radians */ inline double GetDrPos( int form = ofRad ) const { return DrPos[form]; } /** Gets the speedbrake position. @return speedbrake position in radians */ inline double GetDsbPos( int form = ofRad ) const { return DsbPos[form]; } /** Gets the spoiler position. @return spoiler position in radians */ inline double GetDspPos( int form = ofRad ) const { return DspPos[form]; } /** Gets the flaps position. @return flaps position in radians */ inline double GetDfPos( int form = ofRad ) const { return DfPos[form]; } /** Gets the throttle position. @param engine engine ID number @return throttle position for the given engine in range from 0 - 1.0 */ double GetThrottlePos(int engine) const; /** 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]; } /** Gets the steering position. @return steering position in degrees */ double GetSteerPosDeg(int gear) const { return SteerPosDeg[gear]; } /** 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; } /** Gets the tailhook position (0 up, 1 down) @return tailhook position (0 up, 1 down) */ inline double GetTailhookPos(void) const { return TailhookPos; } /** Gets the wing fold position (0 unfolded, 1 folded) @return wing fold position (0 unfolded, 1 folded) */ inline 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]; } /** 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]; } //@} /** 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 @return a string containing the descriptive names for all components */ string GetComponentStrings(string delimeter); /** Retrieves all component outputs for inclusion in output stream @param delimeter 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); /// @name Pilot input command setting //@{ /** Sets the aileron command @param cmd aileron command */ inline void SetDaCmd( double cmd ) { DaCmd = cmd; } /** Sets the elevator command @param cmd elevator command in percent*/ inline void SetDeCmd(double cmd ) { DeCmd = cmd; } /** Sets the rudder command @param cmd rudder command in percent*/ inline void SetDrCmd(double cmd) { DrCmd = cmd; } /** Sets the steering command @param cmd steering command in percent*/ inline void SetDsCmd(double cmd) { DsCmd = cmd; } /** Sets the flaps command @param cmd flaps command in percent*/ inline void SetDfCmd(double cmd) { DfCmd = cmd; } /** Sets the speedbrake command @param cmd speedbrake command in percent*/ inline void SetDsbCmd(double cmd) { DsbCmd = cmd; } /** Sets the spoilers command @param cmd spoilers command in percent*/ inline 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; } /** Sets the rudder trim command @param cmd rudder trim command in percent*/ inline 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; } /** Sets the throttle command for the specified engine @param engine engine ID number @param cmd throttle command in percent (0 - 100)*/ 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)*/ void SetMixtureCmd(int engine, double cmd); /** Set the gear extend/retract command, defaults to down @param gear command 0 for up, 1 for down */ void SetGearCmd(double gearcmd) { GearCmd = gearcmd; } /** Sets the propeller pitch command for the specified engine @param engine engine ID number @param cmd mixture command in percent (0.0 - 1.0)*/ void SetPropAdvanceCmd(int engine, double cmd); /** Sets the propeller feather command for the specified engine @param engine engine ID number @param cmd feather (bool)*/ void SetFeatherCmd(int engine, bool cmd); //@} /// @name Aerosurface position setting //@{ /** Sets the left aileron position @param cmd left aileron position in radians*/ inline 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 ); /** Sets the elevator position @param cmd elevator position in radians*/ inline void SetDePos( int form , double pos ); /** Sets the rudder position @param cmd rudder position in radians*/ inline void SetDrPos( int form , double pos ); /** Sets the flaps position @param cmd flaps position in radians*/ inline void SetDfPos( int form , double pos ); /** Sets the speedbrake position @param cmd speedbrake position in radians*/ inline void SetDsbPos( int form , double pos ); /** Sets the spoiler position @param cmd spoiler position in radians*/ inline 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)*/ 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)*/ void SetMixturePos(int engine, double cmd); /** Sets the steering position @param cmd steering position in degrees*/ void SetSteerPosDeg(int gear, double pos) { SteerPosDeg[gear] = pos; } /** Set the gear extend/retract position, defaults to down @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 @param cmd prop pitch setting in percent (0.0 - 1.0)*/ void SetPropAdvance(int engine, double cmd); /** Sets the actual prop feather setting for the specified engine @param engine engine ID number @param cmd prop fether setting (bool)*/ void SetPropFeather(int engine, bool cmd); //@} /// @name Landing Gear brakes //@{ /** Sets the left brake group @param cmd brake setting in percent (0.0 - 1.0) */ void SetLBrake(double cmd) {LeftBrake = cmd;} /** Sets the right brake group @param cmd brake setting in percent (0.0 - 1.0) */ void SetRBrake(double cmd) {RightBrake = cmd;} /** Sets the center brake group @param cmd brake setting in percent (0.0 - 1.0) */ void SetCBrake(double cmd) {CenterBrake = cmd;} /** Gets the brake for a specified group. @param bg which brakegroup to retrieve the command for @return the brake setting for the supplied brake group argument */ double GetBrake(FGLGear::BrakeGroup bg); /** Gets the left brake. @return the left brake setting. */ double GetLBrake(void) const {return LeftBrake;} /** Gets the right brake. @return the right brake setting. */ double GetRBrake(void) const {return RightBrake;} /** Gets the center brake. @return the center brake setting. */ double GetCBrake(void) const {return CenterBrake;} //@} enum SystemType { stFCS, stSystem, stAutoPilot }; /** Loads the Flight Control System. Load() is called from FGFDMExec. @param el pointer to the Element instance @param systype type of system (FCS, Autopilot, System) @return true if succesful */ bool Load(Element* el, SystemType systype); ifstream* FindSystemFile(string system_filename); string FindSystemFullPathname(string system_filename); void AddThrottle(void); void AddGear(void); double GetDt(void); FGPropertyManager* GetPropertyManager(void) { return PropertyManager; }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; double LeftBrake, RightBrake, CenterBrake; // Brake settings double GearCmd,GearPos; double TailhookPos, WingFoldPos; typedef 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); void Debug(int from);};}#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?