]> git.mxchange.org Git - flightgear.git/blobdiff - src/Autopilot/xmlauto.hxx
Create a "passive" mode for the autopilot. This is analogous to running the
[flightgear.git] / src / Autopilot / xmlauto.hxx
index 7d87dc7cf7a150c5bbbdca0f5689d39386f4305e..38cfef890dc4957409b05878a6a3c2846f4f5817 100644 (file)
@@ -16,7 +16,7 @@
 //
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //
 // $Id$
 
@@ -45,6 +45,8 @@ SG_USING_STD(deque);
 #include <simgear/props/props.hxx>
 #include <simgear/structure/subsystem_mgr.hxx>
 
+#include <Main/fg_props.hxx>
+
 
 /**
  * Base class for other autopilot components
@@ -56,20 +58,24 @@ protected:
 
     string name;
 
-    SGPropertyNode *enable_prop;
+    SGPropertyNode_ptr enable_prop;
+    SGPropertyNode_ptr passive_mode;
     string enable_value;
+    bool honor_passive;
     bool enabled;
 
-    SGPropertyNode *input_prop;
-    SGPropertyNode *r_n_prop;
+    SGPropertyNode_ptr input_prop;
+    SGPropertyNode_ptr r_n_prop;
     double r_n_value;
-    vector <SGPropertyNode *> output_list;
+    vector <SGPropertyNode_ptr> output_list;
 
 public:
 
     FGXMLAutoComponent() :
       enable_prop( NULL ),
+      passive_mode( fgGetNode("/autopilot/settings/passive-mode", true) ),
       enable_value( "" ),
+      honor_passive( false ),
       enabled( false ),
       input_prop( NULL ),
       r_n_prop( NULL ),
@@ -78,9 +84,9 @@ public:
 
     virtual ~FGXMLAutoComponent() {}
 
-    virtual void update (double dt) {}
+    virtual void update (double dt)=0;
     
-    inline string get_name() { return name; }
+    inline const string& get_name() { return name; }
 };
 
 
@@ -100,6 +106,8 @@ private:
     double r_n;                 // reference (set point) value
     double y_scale;             // scale process input from property system
     double r_scale;             // scale reference input from property system
+    double y_offset;
+    double r_offset;
 
     // Configuration values
     double Kp;                  // proportional gain
@@ -123,6 +131,8 @@ private:
     double edf_n_1;             // edf[n-1] (derivative error)
     double edf_n_2;             // edf[n-2] (derivative error)
     double u_n_1;               // u[n-1]   (output)
+    double desiredTs;            // desired sampling interval (sec)
+    double elapsedTime;          // elapsed time (sec)
     
     
     
@@ -148,7 +158,7 @@ private:
     // proportional component data
     bool proportional;
     double Kp;
-    SGPropertyNode *offset_prop;
+    SGPropertyNode_ptr offset_prop;
     double offset_value;
 
     // integral component data
@@ -270,7 +280,7 @@ protected:
 private:
 
     bool serviceable;
-    SGPropertyNode *config_props;
+    SGPropertyNode_ptr config_props;
     comp_list components;
 };