1
0
Fork 0

Changes to better support arbitrary external flight models.

This commit is contained in:
curt 2001-09-04 14:38:15 +00:00
parent a6ab6f0117
commit a691a3a3f6
7 changed files with 35 additions and 16 deletions

View file

@ -405,6 +405,8 @@ bool FGInterface::update( int multi_loop ) {
void FGInterface::_updatePosition( double lat_geoc, double lon, double alt ) {
double lat_geod, tmp_alt, sl_radius1, sl_radius2, tmp_lat_geoc;
// cout << "starting sea level rad = " << get_Sea_level_radius() << endl;
sgGeocToGeod( lat_geoc, ( get_Sea_level_radius() + alt ) * SG_FEET_TO_METER,
&lat_geod, &tmp_alt, &sl_radius1 );
sgGeodToGeoc( lat_geod, alt * SG_FEET_TO_METER, &sl_radius2, &tmp_lat_geoc );

View file

@ -285,7 +285,8 @@ private:
// SGTimeStamp valid_stamp; // time this record is valid
// SGTimeStamp next_stamp; // time this record is valid
protected:
// protected:
public:
// deliberately not virtual so that
// FGInterface constructor will call

View file

@ -42,6 +42,7 @@
#include <Network/joyclient.hxx>
#include <Network/native.hxx>
#include <Network/native_ctrls.hxx>
#include <Network/native_fdm.hxx>
#include <Network/nmea.hxx>
#include <Network/props.hxx>
#include <Network/pve.hxx>
@ -100,6 +101,9 @@ static FGProtocol *parse_port_config( const string& config )
} else if ( protocol == "native_ctrls" ) {
FGNativeCtrls *native_ctrls = new FGNativeCtrls;
io = native_ctrls;
} else if ( protocol == "native_fdm" ) {
FGNativeFDM *native_fdm = new FGNativeFDM;
io = native_fdm;
} else if ( protocol == "nmea" ) {
FGNMEA *nmea = new FGNMEA;
io = nmea;

View file

@ -796,6 +796,8 @@ parse_option (const string& arg)
add_channel( "native", arg.substr(9) );
} else if ( arg.find( "--native-ctrls=" ) == 0 ) {
add_channel( "native_ctrls", arg.substr(15) );
} else if ( arg.find( "--native-fdm=" ) == 0 ) {
add_channel( "native_fdm", arg.substr(13) );
} else if ( arg.find( "--garmin=" ) == 0 ) {
add_channel( "garmin", arg.substr(9) );
} else if ( arg.find( "--nmea=" ) == 0 ) {

View file

@ -8,10 +8,11 @@ libNetwork_a_SOURCES = \
joyclient.cxx joyclient.hxx \
native.cxx native.hxx \
native_ctrls.cxx native_ctrls.hxx \
native_fdm.cxx native_fdm.hxx \
nmea.cxx nmea.hxx \
props.cxx props.hxx \
pve.cxx pve.hxx \
raw_ctrls.hxx \
raw_ctrls.hxx raw_fdm.hxx \
ray.cxx ray.hxx \
rul.cxx rul.hxx

View file

@ -55,9 +55,10 @@ bool FGNativeCtrls::open() {
}
static void global2raw( FGControls *global, FGRawCtrls *raw ) {
static void global2raw( const FGControls *global, FGRawCtrls *raw ) {
int i;
raw->version = FG_RAW_CTRLS_VERSION;
raw->aileron = globals->get_controls()->get_aileron();
raw->elevator = globals->get_controls()->get_elevator();
raw->elevator_trim = globals->get_controls()->get_elevator_trim();
@ -74,21 +75,27 @@ static void global2raw( FGControls *global, FGRawCtrls *raw ) {
}
static void raw2global( FGRawCtrls *raw, FGControls *global ) {
static void raw2global( const FGRawCtrls *raw, FGControls *global ) {
int i;
globals->get_controls()->set_aileron( raw->aileron );
globals->get_controls()->set_elevator( raw->elevator );
globals->get_controls()->set_elevator_trim( raw->elevator_trim );
globals->get_controls()->set_rudder( raw->rudder );
globals->get_controls()->set_flaps( raw->flaps );
for ( i = 0; i < FG_MAX_ENGINES; ++i ) {
globals->get_controls()->set_throttle( i, raw->throttle[i] );
globals->get_controls()->set_mixture( i, raw->mixture[i] );
globals->get_controls()->set_prop_advance( i, raw->prop_advance[i] );
}
for ( i = 0; i < FG_MAX_WHEELS; ++i ) {
globals->get_controls()->set_brake( i, raw->brake[i] );
if ( raw->version == FG_RAW_CTRLS_VERSION ) {
globals->get_controls()->set_aileron( raw->aileron );
globals->get_controls()->set_elevator( raw->elevator );
globals->get_controls()->set_elevator_trim( raw->elevator_trim );
globals->get_controls()->set_rudder( raw->rudder );
globals->get_controls()->set_flaps( raw->flaps );
for ( i = 0; i < FG_MAX_ENGINES; ++i ) {
globals->get_controls()->set_throttle( i, raw->throttle[i] );
globals->get_controls()->set_mixture( i, raw->mixture[i] );
globals->get_controls()->set_prop_advance( i, raw->prop_advance[i]);
}
for ( i = 0; i < FG_MAX_WHEELS; ++i ) {
globals->get_controls()->set_brake( i, raw->brake[i] );
}
} else {
SG_LOG( SG_IO, SG_ALERT, "Error: version mismatch in raw2global()" );
SG_LOG( SG_IO, SG_ALERT,
"\tsomeone needs to upgrade raw_ctrls.hxx and recompile." );
}
}

View file

@ -30,6 +30,7 @@
# error This library requires C++
#endif
const int FG_RAW_CTRLS_VERSION = 1;
const int FG_MAX_ENGINES = 10;
const int FG_MAX_WHEELS = 3;
@ -40,6 +41,7 @@ class FGRawCtrls {
public:
int version; // increment when data values change
double aileron; // -1 ... 1
double elevator; // -1 ... 1
double elevator_trim; // -1 ... 1