#define _NEWAUTO_HXX
-#include <simgear/misc/props.hxx>
+#include <simgear/props/props.hxx>
+#include <simgear/structure/subsystem_mgr.hxx>
#include <simgear/route/waypoint.hxx>
-#include <Main/fgfs.hxx>
#include <Main/fg_props.hxx>
// Structures
-class FGAutopilot : public FGSubsystem
+class FGAutopilot : public SGSubsystem
{
public:
FG_ALTITUDE_GS1 = 2, // follow glide slope 1
FG_ALTITUDE_GS2 = 3, // follow glide slope 2
FG_ALTITUDE_ARM = 4, // ascend to selected altitude
- FG_TRUE_ALTITUDE_LOCK = 5 // lock to a specific true altitude
- // (i.e. a perfect world)
+ FG_TRUE_ALTITUDE_LOCK = 5, // lock to a specific true altitude
+ // (i.e. a perfect world)
+ FG_VERT_SPEED = 6 // ascend or descend at selected fpm
};
-
private:
bool heading_hold; // the current state of the heading hold
double TargetAltitude; // altitude to hold
double TargetAGL; // the terrain separation
+ double TargetVertSpeed; // vertical speed to shoot for
+
double TargetSpeed; // speed to shoot for
double alt_error_accum; // altitude error accumulator
double climb_error_accum; // climb error accumulator (for GS)
double speed_error_accum; // speed error accumulator
+ double current_ap_throttle; // current ap stored throttle setting used to set all engines
+ double previous_speed; // used to detect acceleration rate
+
double TargetSlope; // the glide slope hold value
double MaxRoll ; // the max the plane can roll for the turn
SGPropertyNode *altitude_agl_node;
SGPropertyNode *vertical_speed_node;
SGPropertyNode *heading_node;
- SGPropertyNode *dg_heading_node;
+ SGPropertyNode *indicated_heading_node;
SGPropertyNode *roll_node;
SGPropertyNode *pitch_node;
+ SGPropertyNode *airspeed_node;
SGPropertyNode *min_climb; // minimum climb speed
SGPropertyNode *best_climb; // best climb speed
SGPropertyNode *max_roll_node; // maximum roll setting in degrees
SGPropertyNode *roll_out_node; // start rollout offset from desired heading in degrees
SGPropertyNode *roll_out_smooth_node; // rollout smoothing offset in degrees
+ SGPropertyNode *throttle_adj_factor; // factor to optimize autothrottle adjustments
+ SGPropertyNode *throttle_integral; // amount of contribution of the integral
+ // component of the pid
+ SGPropertyNode *speed_change_node; // anticipated speed change
SGPropertyNode *TargetClimbRate; // target climb rate
SGPropertyNode *TargetDescentRate; // target decent rate
SGPropertyNode *current_throttle; // current throttle (engine 0)
+ SGPropertyNode *terrain_follow_factor; // modifies the climb rate to
+ // permit more control when using terrain following mode
public:
\f
////////////////////////////////////////////////////////////////////
- // Implementation of FGSubsystem.
+ // Implementation of SGSubsystem.
////////////////////////////////////////////////////////////////////
void init ();
inline void set_TargetDistance( double val ) { TargetDistance = val; }
inline double get_TargetAltitude() const { return TargetAltitude; }
inline void set_TargetAltitude( double val ) { TargetAltitude = val; }
+ inline double get_TargetSpeed() const { return TargetSpeed; }
+ inline void set_TargetSpeed( double val ) { TargetSpeed = val; }
inline double get_TargetAGL() const { return TargetAGL; }
inline void set_TargetAGL( double val ) { TargetAGL = val; }
inline double get_TargetClimbRate() const {
void setAPAltitude (double altitude);
bool getAPGSLock () const;
void setAPGSLock (bool lock);
+ bool getAPVertSpeedLock () const;
+ void setAPVertSpeedLock (bool lock);
bool getAPTerrainLock () const;
void setAPTerrainLock (bool lock);
double getAPClimb () const;
void setAPHeadingLock (bool lock);
double getAPHeadingBug () const;
void setAPHeadingBug (double heading);
+ const char * getAPwaypoint () const;
+ void setAPwaypoint (const char * apt);
bool getAPWingLeveler () const;
void setAPWingLeveler (bool lock);
bool getAPNAV1Lock () const;
void setAPNAV1Lock (bool lock);
bool getAPAutoThrottleLock () const;
void setAPAutoThrottleLock (bool lock);
+ double getAPAutoThrottle () const;
+ void setAPAutoThrottle (double altitude);
double getAPRudderControl () const;
void setAPRudderControl (double value);
double getAPElevatorControl () const;
void setAPElevatorControl (double value);
double getAPThrottleControl () const;
void setAPThrottleControl (double value);
+ double getAPVertSpeed () const;
+ void setAPVertSpeed (double speed);
};