]> git.mxchange.org Git - flightgear.git/commitdiff
Various tweaks for support of external flight models running as seperate
authorcurt <curt>
Fri, 26 Oct 2001 05:42:08 +0000 (05:42 +0000)
committercurt <curt>
Fri, 26 Oct 2001 05:42:08 +0000 (05:42 +0000)
processes.

src/Network/native_ctrls.cxx
src/Network/native_fdm.cxx
src/Network/raw_ctrls.hxx
src/Network/raw_fdm.hxx

index 2cc20ff5f56c50e3755f69ccc2556cd5eb8c0b9c..f34367dbc722f516fa9fda12c1a3ab4bf58de9f2 100644 (file)
@@ -24,6 +24,8 @@
 #include <simgear/debug/logstream.hxx>
 #include <simgear/io/iochannel.hxx>
 
+#include <Scenery/scenery.hxx> // ground elevation
+
 #include "native_ctrls.hxx"
 
 
@@ -72,6 +74,8 @@ static void global2raw( const FGControls *global, FGRawCtrls *raw ) {
     for ( i = 0; i < FG_MAX_WHEELS; ++i ) {
        raw->brake[i] =  globals->get_controls()->get_brake(i);
     }
+
+    raw->hground = scenery.cur_elev;
 }
 
 
@@ -92,6 +96,7 @@ static void raw2global( const FGRawCtrls *raw, FGControls *global ) {
        for ( i = 0; i < FG_MAX_WHEELS; ++i ) {
            globals->get_controls()->set_brake( i, raw->brake[i] );
        }
+       scenery.cur_elev = raw->hground;
     } else {
        SG_LOG( SG_IO, SG_ALERT, "Error: version mismatch in raw2global()" );
        SG_LOG( SG_IO, SG_ALERT,
index efa46c8b8db787895bcf3af22120a981cfd1d705..0c7049c0dfe0ba173d433a49e95caece82ea4aa7 100644 (file)
@@ -60,12 +60,18 @@ bool FGNativeFDM::open() {
 
 static void global2raw( const FGInterface *global, FGRawFDM *raw ) {
     raw->version = FG_RAW_FDM_VERSION;
+
+    // positions
     raw->longitude = cur_fdm_state->get_Longitude();
     raw->latitude = cur_fdm_state->get_Latitude();
     raw->altitude = cur_fdm_state->get_Altitude();
     raw->phi = cur_fdm_state->get_Phi();
     raw->theta = cur_fdm_state->get_Theta();
     raw->psi = cur_fdm_state->get_Psi();
+
+    // velocities
+    raw->vcas = cur_fdm_state->get_V_calibrated_kts();
+    raw->climb_rate = cur_fdm_state->get_Climb_Rate();
 }
 
 
@@ -78,6 +84,8 @@ static void raw2global( const FGRawFDM *raw, FGInterface *global ) {
        cur_fdm_state->_set_Euler_Angles( raw->phi,
                                          raw->theta,
                                          raw->psi );
+       cur_fdm_state->_set_V_calibrated_kts( raw->vcas );
+       cur_fdm_state->_set_Climb_Rate( raw->climb_rate );
     } else {
        SG_LOG( SG_IO, SG_ALERT, "Error: version mismatch in raw2global()" );
        SG_LOG( SG_IO, SG_ALERT,
index dafedece8875eb2f3d9d9419f6f64b78d252ec53..91a74cf41e0ba0efb65da2b6c3372ca43473c853 100644 (file)
@@ -30,7 +30,7 @@
 # error This library requires C++
 #endif                                   
 
-const int FG_RAW_CTRLS_VERSION = 1;
+const int FG_RAW_CTRLS_VERSION = 2;
 
 const int FG_MAX_ENGINES = 10;
 const int FG_MAX_WHEELS = 3;
@@ -42,6 +42,8 @@ class FGRawCtrls {
 public:
 
     int version;                        // increment when data values change
+
+    // Controls
     double aileron;                     // -1 ... 1
     double elevator;                    // -1 ... 1
     double elevator_trim;               // -1 ... 1
@@ -52,6 +54,8 @@ public:
     double prop_advance[FG_MAX_ENGINES]; //  0 ... 1
     double brake[FG_MAX_WHEELS];         //  0 ... 1
 
+    // Other interesting/useful values
+    double hground;                     // ground elevation (meters)
 };
 
 
index 1b2cf7b174f674b3a274228115d8267b39ead283..e5f8b7ed33f309c97d1bfa6171cd9dd2b6f9b9bb 100644 (file)
@@ -30,7 +30,7 @@
 # error This library requires C++
 #endif                                   
 
-const int FG_RAW_FDM_VERSION = 1;
+const int FG_RAW_FDM_VERSION = 3;
 
 // Define a structure containing the top level flight dynamics model
 // parameters
@@ -40,6 +40,8 @@ class FGRawFDM {
 public:
 
     int version;               // increment when data values change
+
+    // Positions
     double longitude;          // radians
     double latitude;           // radians
     double altitude;           // meters (above sea level)
@@ -47,6 +49,10 @@ public:
     double phi;                        // radians
     double theta;              // radians
     double psi;                        // radians
+
+    // Velocities
+    double vcas;               // calibrated airspeed
+    double climb_rate;         // feet per second
 };