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 );
// 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
#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>
} 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;
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 ) {
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
}
-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();
}
-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." );
}
}
# 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;
public:
+ int version; // increment when data values change
double aileron; // -1 ... 1
double elevator; // -1 ... 1
double elevator_trim; // -1 ... 1