From 7c5c00018455d767776007b2fc2fe404dba48ae3 Mon Sep 17 00:00:00 2001 From: curt Date: Fri, 4 Dec 1998 01:29:37 +0000 Subject: [PATCH] Stubbed in a new flight model called "External" which is expected to be driven from some external source. --- FDM/Makefile.am | 2 +- FDM/flight.cxx | 35 ++++++++++++++++++++++------------- FDM/flight.hxx | 44 +++++++++++++++++++++++--------------------- 3 files changed, 46 insertions(+), 35 deletions(-) diff --git a/FDM/Makefile.am b/FDM/Makefile.am index 3d8eec007..015e2bf8a 100644 --- a/FDM/Makefile.am +++ b/FDM/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = LaRCsim Slew +SUBDIRS = External LaRCsim Slew noinst_LIBRARIES = libFlight.a diff --git a/FDM/flight.cxx b/FDM/flight.cxx index 6a3004840..ddaf49615 100644 --- a/FDM/flight.cxx +++ b/FDM/flight.cxx @@ -28,6 +28,7 @@ #include "LaRCsim.hxx" #include +#include #include #include #include @@ -36,31 +37,33 @@ fgFLIGHT cur_flight_params; -/* Initialize the flight model parameters */ +// Initialize the flight model parameters int fgFlightModelInit(int model, fgFLIGHT& f, double dt) { double save_alt = 0.0; int result; FG_LOG( FG_FLIGHT ,FG_INFO, "Initializing flight model" ); - if ( model == FG_SLEW ) { + if ( model == fgFLIGHT::FG_SLEW ) { // fgSlewInit(dt); - } else if ( model == FG_LARCSIM ) { - /* lets try to avoid really screwing up the LaRCsim model */ + } else if ( model == fgFLIGHT::FG_LARCSIM ) { + // lets try to avoid really screwing up the LaRCsim model if ( f.get_Altitude() < -9000.0 ) { save_alt = f.get_Altitude(); f.set_Altitude( 0.0 ); } - fgFlight_2_LaRCsim(f); /* translate FG to LaRCsim structure */ + fgFlight_2_LaRCsim(f); // translate FG to LaRCsim structure fgLaRCsimInit(dt); FG_LOG( FG_FLIGHT, FG_INFO, "FG pos = " << f.get_Latitude() ); - fgLaRCsim_2_Flight(f); /* translate LaRCsim back to FG structure */ + fgLaRCsim_2_Flight(f); // translate LaRCsim back to FG structure - /* but lets restore our original bogus altitude when we are done */ + // but lets restore our original bogus altitude when we are done if ( save_alt < -9000.0 ) { f.set_Altitude( save_alt ); } + } else if ( model == fgFLIGHT::FG_EXTERNAL ) { + fgExternalInit(f, dt); } else { FG_LOG( FG_FLIGHT, FG_WARN, "Unimplemented flight model == " << model ); @@ -72,7 +75,7 @@ int fgFlightModelInit(int model, fgFLIGHT& f, double dt) { } -/* Run multiloop iterations of the flight model */ +// Run multiloop iterations of the flight model int fgFlightModelUpdate(int model, fgFLIGHT& f, int multiloop) { double time_step, start_elev, end_elev; int result; @@ -81,10 +84,12 @@ int fgFlightModelUpdate(int model, fgFLIGHT& f, int multiloop) { time_step = (1.0 / DEFAULT_MODEL_HZ) * multiloop; start_elev = f.get_Altitude(); - if ( model == FG_SLEW ) { + if ( model == fgFLIGHT::FG_SLEW ) { // fgSlewUpdate(f, multiloop); - } else if ( model == FG_LARCSIM ) { + } else if ( model == fgFLIGHT::FG_LARCSIM ) { fgLaRCsimUpdate(f, multiloop); + } else if ( model == fgFLIGHT::FG_EXTERNAL ) { + // fgExternalUpdate(f, multiloop); } else { FG_LOG( FG_FLIGHT, FG_WARN, "Unimplemented flight model == " << model ); @@ -101,7 +106,7 @@ int fgFlightModelUpdate(int model, fgFLIGHT& f, int multiloop) { } -/* Set the altitude (force) */ +// Set the altitude (force) void fgFlightModelSetAltitude(int model, fgFLIGHT& f, double alt_meters) { double sea_level_radius_meters; double lat_geoc; @@ -113,8 +118,8 @@ void fgFlightModelSetAltitude(int model, fgFLIGHT& f, double alt_meters) { f.set_Radius_to_vehicle( f.get_Altitude() + (sea_level_radius_meters * METER_TO_FEET) ); - /* additional work needed for some flight models */ - if ( model == FG_LARCSIM ) { + // additional work needed for some flight models + if ( model == fgFLIGHT::FG_LARCSIM ) { ls_ForceAltitude( f.get_Altitude() ); } @@ -122,6 +127,10 @@ void fgFlightModelSetAltitude(int model, fgFLIGHT& f, double alt_meters) { // $Log$ +// Revision 1.5 1998/12/04 01:29:39 curt +// Stubbed in a new flight model called "External" which is expected to be driven +// from some external source. +// // Revision 1.4 1998/12/03 01:16:40 curt // Converted fgFLIGHT to a class. // diff --git a/FDM/flight.hxx b/FDM/flight.hxx index 24301e71a..bbedb8940 100644 --- a/FDM/flight.hxx +++ b/FDM/flight.hxx @@ -34,27 +34,6 @@ #endif -// Define the various supported flight models (most not yet implemented) - -enum fgFlightModelKind { - // Slew (in MS terminology) - FG_SLEW = 0, - - // The only "real" model that is currently implemented - FG_LARCSIM = 1, - - FG_ACM = 2, - FG_SUPER_SONIC = 3, - FG_HELICOPTER = 4, - FG_AUTOGYRO = 5, - FG_BALLOON = 6, - FG_PARACHUTE = 7, - - // Driven externally via a serial port, net, file, etc. - FG_EXTERN = 8 -}; - - typedef double FG_VECTOR_3[3]; @@ -63,6 +42,25 @@ class fgFLIGHT { public: + // Define the various supported flight models (many not yet implemented) + enum { + // Slew (in MS terminology) + FG_SLEW = 0, + + // The only "real" model that is currently implemented + FG_LARCSIM = 1, + + FG_ACM = 2, + FG_SUPER_SONIC = 3, + FG_HELICOPTER = 4, + FG_AUTOGYRO = 5, + FG_BALLOON = 6, + FG_PARACHUTE = 7, + + // Driven externally via a serial port, net, file, etc. + FG_EXTERNAL = 8 + }; + /*================== Mass properties and geometry values ==================*/ // Inertias @@ -748,6 +746,10 @@ void fgFlightModelSetAltitude(int model, fgFLIGHT& f, double alt_meters); // $Log$ +// Revision 1.5 1998/12/04 01:29:40 curt +// Stubbed in a new flight model called "External" which is expected to be driven +// from some external source. +// // Revision 1.4 1998/12/03 04:25:03 curt // Working on fixing up new fgFLIGHT class. // -- 2.39.2