]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/ADA.cxx
Solve for the elevator control input during approach. It turns out that
[flightgear.git] / src / FDM / ADA.cxx
index 44fb78fe9ebcb73318c175dfd273cc4a5257e4be..d20e44f321ddce0cf3f3a8c6f362b7b19a4a6a9a 100644 (file)
@@ -156,7 +156,7 @@ struct {
 
 
 FGADA::FGADA( double dt ) {
-    set_delta_t( dt );
+//     set_delta_t( dt );
 }
 
 
@@ -168,9 +168,10 @@ FGADA::~FGADA() {
 // for each subsequent iteration through the EOM
 void FGADA::init() {
 
-       // explicitly call the superclass's
-       // init() method first.
-    FGInterface::init();
+    //do init common to all FDM"s
+    common_init();
+    
+    //now do ADA-specific init.
 
     // cout << "FGADA::init()" << endl;
 
@@ -189,7 +190,7 @@ void FGADA::init() {
     copy_to_FGADA();
        // Write FGExternal structure from socket to establish connection
        int result = fdmsock->write(OutBuffer, nbytes);
-       printf("Connection established.\n");
+       printf("Connection established = %d.\n", result);
     }
 }
 
@@ -197,9 +198,12 @@ void FGADA::init() {
 // Run an iteration of the EOM.  This is essentially a NOP here
 // because these values are getting filled in elsewhere based on
 // external input.
-bool FGADA::update( int multiloop ) {
+void FGADA::update( double dt ) {
     // cout << "FGADA::update()" << endl;
 
+    if (is_suspended())
+      return;
+
     char Buffer[numberofbytes];
     char OutBuffer[nbytes];
 
@@ -218,18 +222,15 @@ bool FGADA::update( int multiloop ) {
 
     copy_to_FGADA();
     fgGetDouble("/sim/view/offset",view_offset);
-       if ( view_offset == 0.0) {
-         memcpy (&OutBuffer, &visuals_to_sixdof, sizeof (OutBuffer));
-                int result = fdmsock->write(OutBuffer, nbytes);
-       }
-
-    return true;
+    if ( view_offset == 0.0) {
+        memcpy (&OutBuffer, &visuals_to_sixdof, sizeof (OutBuffer));
+        fdmsock->write(OutBuffer, nbytes);
+    }
 }
 
 // Convert from the FGInterface struct to the FGADA struct (output)
 bool FGADA::copy_to_FGADA () {
-
-       ground_elevation = scenery.cur_elev;
+    ground_elevation = globals->get_scenery()->get_cur_elev();
     return true;
 }