1
0
Fork 0

Various tweaks for support of external flight models running as seperate

processes.
This commit is contained in:
curt 2001-10-26 05:42:08 +00:00
parent 035b9dabb1
commit d7ec45ca3b
4 changed files with 25 additions and 2 deletions

View 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,

View 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,

View 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)
};

View 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
};