From 1f1b2bab5025e8ce671e9edc0f187ff73117650d Mon Sep 17 00:00:00 2001 From: curt Date: Mon, 10 Apr 2000 20:09:40 +0000 Subject: [PATCH] David Megginson made a few (mostly minor) mods to the LaRCsim files, and it's now possible to choose the LaRCsim model at runtime, as in fgfs --aircraft=c172 or fgfs --aircraft=uiuc --aircraft-dir=Aircraft-uiuc/Boeing747 I did this so that I could play with the UIUC stuff without losing Tony's C172 with its flaps, etc. I did my best to respect the design of the LaRCsim code by staying in C, making only minimal changes, and not introducing any dependencies on the rest of FlightGear. The modified files are attached. --- src/FDM/LaRCsim.cxx | 2 +- src/FDM/LaRCsim/Makefile.am | 27 ++++----------- src/FDM/LaRCsim/c172_aero.c | 4 +-- src/FDM/LaRCsim/c172_engine.c | 2 +- src/FDM/LaRCsim/c172_gear.c | 30 ++++++++++++---- src/FDM/LaRCsim/c172_init.c | 2 +- src/FDM/LaRCsim/c172_init.h | 8 ++--- src/FDM/LaRCsim/cherokee_aero.c | 2 +- src/FDM/LaRCsim/cherokee_engine.c | 2 +- src/FDM/LaRCsim/cherokee_gear.c | 34 +++++++++++++----- src/FDM/LaRCsim/cherokee_init.c | 2 +- src/FDM/LaRCsim/ls_init.c | 57 ++++++++++++++++++++++++++++--- src/FDM/LaRCsim/ls_init.h | 2 +- src/FDM/LaRCsim/ls_interface.c | 24 ++++++++++--- src/FDM/LaRCsim/ls_interface.h | 22 ++++++++++-- src/FDM/LaRCsim/ls_model.c | 57 +++++++++++++++++++++++++++---- src/FDM/LaRCsim/ls_model.h | 9 +++++ src/FDM/LaRCsim/navion_aero.c | 2 +- src/FDM/LaRCsim/navion_engine.c | 2 +- src/FDM/LaRCsim/navion_gear.c | 34 +++++++++++++----- src/FDM/LaRCsim/navion_init.c | 2 +- src/FDM/LaRCsim/navion_init.h | 2 +- src/FDM/LaRCsim/uiuc_aero.c | 18 +++++----- 23 files changed, 255 insertions(+), 91 deletions(-) diff --git a/src/FDM/LaRCsim.cxx b/src/FDM/LaRCsim.cxx index 2b8a25023..58fe14004 100644 --- a/src/FDM/LaRCsim.cxx +++ b/src/FDM/LaRCsim.cxx @@ -50,7 +50,7 @@ int FGLaRCsim::init( double dt ) { copy_to_LaRCsim(); // actual LaRCsim top level init - ls_toplevel_init( dt ); + ls_toplevel_init( dt, (char *)current_options.get_aircraft().c_str() ); FG_LOG( FG_FLIGHT, FG_INFO, "FG pos = " << get_Latitude() ); diff --git a/src/FDM/LaRCsim/Makefile.am b/src/FDM/LaRCsim/Makefile.am index 255042dc4..8f5ba663e 100644 --- a/src/FDM/LaRCsim/Makefile.am +++ b/src/FDM/LaRCsim/Makefile.am @@ -6,26 +6,11 @@ EXTRA_DIST = \ navion_init.h \ uiuc_aero.c -if ENABLE_NAVION -NAVION_MODEL = \ - navion_aero.c navion_engine.c navion_gear.c navion_init.c navion_init.h -else -NAVION_MODEL = -endif - -if ENABLE_C172 -C172_MODEL = c172_aero.c c172_engine.c c172_gear.c c172_init.c navion_init.h -else -C172_MODEL = -endif - -if ENABLE_UIUC -UIUC_MODEL = uiuc_aero.c c172_init.c navion_init.h -else -UIUC_MODEL = -endif - -# AIRCRAFT_MODEL = cherokee_aero.c cherokee_engine.c cherokee_gear.c cherokee_init.c navion_init.h +AIRCRAFT_MODEL = c172_aero.c c172_engine.c c172_gear.c c172_init.c \ + navion_init.h navion_aero.c navion_engine.c \ + navion_gear.c navion_init.c uiuc_aero.c \ + cherokee_aero.c cherokee_engine.c cherokee_gear.c \ + cherokee_init.c noinst_LIBRARIES = libLaRCsim.a @@ -43,7 +28,7 @@ libLaRCsim_a_SOURCES = \ ls_sim_control.h \ ls_step.c ls_step.h \ ls_sym.h ls_types.h \ - $(NAVION_MODEL) $(C172_MODEL) $(UIUC_MODEL) \ + $(AIRCRAFT_MODEL) \ ls_interface.c ls_interface.h INCLUDES += -I$(top_builddir) -I$(top_builddir)/src diff --git a/src/FDM/LaRCsim/c172_aero.c b/src/FDM/LaRCsim/c172_aero.c index 04da35502..9ce8a54ea 100644 --- a/src/FDM/LaRCsim/c172_aero.c +++ b/src/FDM/LaRCsim/c172_aero.c @@ -109,7 +109,7 @@ extern COCKPIT cockpit_; -SCALAR interp(SCALAR *y_table, SCALAR *x_table, int Ntable, SCALAR x) +static SCALAR interp(SCALAR *y_table, SCALAR *x_table, int Ntable, SCALAR x) { SCALAR slope; int i=1; @@ -141,7 +141,7 @@ SCALAR interp(SCALAR *y_table, SCALAR *x_table, int Ntable, SCALAR x) } -void aero( SCALAR dt, int Initialize ) { +void c172_aero( SCALAR dt, int Initialize ) { static int init = 0; diff --git a/src/FDM/LaRCsim/c172_engine.c b/src/FDM/LaRCsim/c172_engine.c index 261395c75..8ab7b4502 100644 --- a/src/FDM/LaRCsim/c172_engine.c +++ b/src/FDM/LaRCsim/c172_engine.c @@ -69,7 +69,7 @@ $Header$ extern SIM_CONTROL sim_control_; -void engine( SCALAR dt, int init ) { +void c172_engine( SCALAR dt, int init ) { float v,h,pa; float bhp=160; diff --git a/src/FDM/LaRCsim/c172_gear.c b/src/FDM/LaRCsim/c172_gear.c index 9bb23952d..1ea4cc6cc 100644 --- a/src/FDM/LaRCsim/c172_gear.c +++ b/src/FDM/LaRCsim/c172_gear.c @@ -36,6 +36,22 @@ $Header$ $Log$ +Revision 1.14 2000/04/10 18:09:41 curt +David Megginson made a few (mostly minor) mods to the LaRCsim files, and +it's now possible to choose the LaRCsim model at runtime, as in + + fgfs --aircraft=c172 + +or + + fgfs --aircraft=uiuc --aircraft-dir=Aircraft-uiuc/Boeing747 + +I did this so that I could play with the UIUC stuff without losing +Tony's C172 with its flaps, etc. I did my best to respect the design +of the LaRCsim code by staying in C, making only minimal changes, and +not introducing any dependencies on the rest of FlightGear. The +modified files are attached. + Revision 1.13 1999/12/13 20:43:41 curt Updates from Tony. @@ -70,47 +86,47 @@ Updates from Tony. #define HEIGHT_AGL_WHEEL d_wheel_rwy_local_v[2] -sub3( DATA v1[], DATA v2[], DATA result[] ) +static sub3( DATA v1[], DATA v2[], DATA result[] ) { result[0] = v1[0] - v2[0]; result[1] = v1[1] - v2[1]; result[2] = v1[2] - v2[2]; } -add3( DATA v1[], DATA v2[], DATA result[] ) +static add3( DATA v1[], DATA v2[], DATA result[] ) { result[0] = v1[0] + v2[0]; result[1] = v1[1] + v2[1]; result[2] = v1[2] + v2[2]; } -cross3( DATA v1[], DATA v2[], DATA result[] ) +static cross3( DATA v1[], DATA v2[], DATA result[] ) { result[0] = v1[1]*v2[2] - v1[2]*v2[1]; result[1] = v1[2]*v2[0] - v1[0]*v2[2]; result[2] = v1[0]*v2[1] - v1[1]*v2[0]; } -multtrans3x3by3( DATA m[][3], DATA v[], DATA result[] ) +static multtrans3x3by3( DATA m[][3], DATA v[], DATA result[] ) { result[0] = m[0][0]*v[0] + m[1][0]*v[1] + m[2][0]*v[2]; result[1] = m[0][1]*v[0] + m[1][1]*v[1] + m[2][1]*v[2]; result[2] = m[0][2]*v[0] + m[1][2]*v[1] + m[2][2]*v[2]; } -mult3x3by3( DATA m[][3], DATA v[], DATA result[] ) +static mult3x3by3( DATA m[][3], DATA v[], DATA result[] ) { result[0] = m[0][0]*v[0] + m[0][1]*v[1] + m[0][2]*v[2]; result[1] = m[1][0]*v[0] + m[1][1]*v[1] + m[1][2]*v[2]; result[2] = m[2][0]*v[0] + m[2][1]*v[1] + m[2][2]*v[2]; } -clear3( DATA v[] ) +static clear3( DATA v[] ) { v[0] = 0.; v[1] = 0.; v[2] = 0.; } -gear() +c172_gear() { char rcsid[] = "$Id$"; #define NUM_WHEELS 4 diff --git a/src/FDM/LaRCsim/c172_init.c b/src/FDM/LaRCsim/c172_init.c index 63cce2308..3f3be9d57 100644 --- a/src/FDM/LaRCsim/c172_init.c +++ b/src/FDM/LaRCsim/c172_init.c @@ -62,7 +62,7 @@ #include "ls_constants.h" #include "c172_aero.h" -void model_init( void ) { +void c172_init( void ) { Throttle[3] = 0.2; diff --git a/src/FDM/LaRCsim/c172_init.h b/src/FDM/LaRCsim/c172_init.h index f7d097e14..a4867d28b 100644 --- a/src/FDM/LaRCsim/c172_init.h +++ b/src/FDM/LaRCsim/c172_init.h @@ -1,11 +1,11 @@ /* a quick navion_init.h */ -#ifndef _NAVION_INIT_H -#define _NAVION_INIT_H +#ifndef _C172_INIT_H +#define _C172_INIT_H -void model_init( void ); +void c172_init( void ); -#endif _NAVION_INIT_H +#endif _C172_INIT_H diff --git a/src/FDM/LaRCsim/cherokee_aero.c b/src/FDM/LaRCsim/cherokee_aero.c index 665f80cc2..19b9b219b 100644 --- a/src/FDM/LaRCsim/cherokee_aero.c +++ b/src/FDM/LaRCsim/cherokee_aero.c @@ -66,7 +66,7 @@ This source is not checked in this configuration in any way. -void aero() +void cherokee_aero() /*float ** Cherokee (float t, VectorStanja &X, float *U)*/ { static float diff --git a/src/FDM/LaRCsim/cherokee_engine.c b/src/FDM/LaRCsim/cherokee_engine.c index e67a8b9b9..3b55ca28e 100644 --- a/src/FDM/LaRCsim/cherokee_engine.c +++ b/src/FDM/LaRCsim/cherokee_engine.c @@ -36,7 +36,7 @@ This source is not checked in this configuration in any way. -void engine( SCALAR dt, int init ) +void cherokee_engine( SCALAR dt, int init ) { static float diff --git a/src/FDM/LaRCsim/cherokee_gear.c b/src/FDM/LaRCsim/cherokee_gear.c index c7fa3ba29..27cf80cc6 100644 --- a/src/FDM/LaRCsim/cherokee_gear.c +++ b/src/FDM/LaRCsim/cherokee_gear.c @@ -36,8 +36,24 @@ $Header$ $Log$ -Revision 1.1 1999/06/17 18:07:34 curt -Initial revision +Revision 1.2 2000/04/10 18:09:41 curt +David Megginson made a few (mostly minor) mods to the LaRCsim files, and +it's now possible to choose the LaRCsim model at runtime, as in + + fgfs --aircraft=c172 + +or + + fgfs --aircraft=uiuc --aircraft-dir=Aircraft-uiuc/Boeing747 + +I did this so that I could play with the UIUC stuff without losing +Tony's C172 with its flaps, etc. I did my best to respect the design +of the LaRCsim code by staying in C, making only minimal changes, and +not introducing any dependencies on the rest of FlightGear. The +modified files are attached. + +Revision 1.1.1.1 1999/06/17 18:07:34 curt +Start of 0.7.x branch Revision 1.1.1.1 1999/04/05 21:32:45 curt Start of 0.6.x branch. @@ -71,47 +87,47 @@ Start of 0.6.x branch. #include "ls_cockpit.h" -void sub3( DATA v1[], DATA v2[], DATA result[] ) +static void sub3( DATA v1[], DATA v2[], DATA result[] ) { result[0] = v1[0] - v2[0]; result[1] = v1[1] - v2[1]; result[2] = v1[2] - v2[2]; } -void add3( DATA v1[], DATA v2[], DATA result[] ) +static void add3( DATA v1[], DATA v2[], DATA result[] ) { result[0] = v1[0] + v2[0]; result[1] = v1[1] + v2[1]; result[2] = v1[2] + v2[2]; } -void cross3( DATA v1[], DATA v2[], DATA result[] ) +static void cross3( DATA v1[], DATA v2[], DATA result[] ) { result[0] = v1[1]*v2[2] - v1[2]*v2[1]; result[1] = v1[2]*v2[0] - v1[0]*v2[2]; result[2] = v1[0]*v2[1] - v1[1]*v2[0]; } -void multtrans3x3by3( DATA m[][3], DATA v[], DATA result[] ) +static void multtrans3x3by3( DATA m[][3], DATA v[], DATA result[] ) { result[0] = m[0][0]*v[0] + m[1][0]*v[1] + m[2][0]*v[2]; result[1] = m[0][1]*v[0] + m[1][1]*v[1] + m[2][1]*v[2]; result[2] = m[0][2]*v[0] + m[1][2]*v[1] + m[2][2]*v[2]; } -void mult3x3by3( DATA m[][3], DATA v[], DATA result[] ) +static void mult3x3by3( DATA m[][3], DATA v[], DATA result[] ) { result[0] = m[0][0]*v[0] + m[0][1]*v[1] + m[0][2]*v[2]; result[1] = m[1][0]*v[0] + m[1][1]*v[1] + m[1][2]*v[2]; result[2] = m[2][0]*v[0] + m[2][1]*v[1] + m[2][2]*v[2]; } -void clear3( DATA v[] ) +static void clear3( DATA v[] ) { v[0] = 0.; v[1] = 0.; v[2] = 0.; } -void gear() +void cherokee_gear() { char rcsid[] = "$Id$"; diff --git a/src/FDM/LaRCsim/cherokee_init.c b/src/FDM/LaRCsim/cherokee_init.c index 23ce52915..8581da87f 100644 --- a/src/FDM/LaRCsim/cherokee_init.c +++ b/src/FDM/LaRCsim/cherokee_init.c @@ -48,7 +48,7 @@ #include "ls_generic.h" #include "ls_cockpit.h" -void model_init( void ) +void cherokee_init( void ) { Throttle[3] = 0.2; Rudder_pedal = 0; Lat_control = 0; Long_control = 0; diff --git a/src/FDM/LaRCsim/ls_init.c b/src/FDM/LaRCsim/ls_init.c index 9601bc994..224724118 100644 --- a/src/FDM/LaRCsim/ls_init.c +++ b/src/FDM/LaRCsim/ls_init.c @@ -34,8 +34,24 @@ $Header$ $Log$ -Revision 1.1 1999/06/17 18:07:34 curt -Initial revision +Revision 1.2 2000/04/10 18:09:41 curt +David Megginson made a few (mostly minor) mods to the LaRCsim files, and +it's now possible to choose the LaRCsim model at runtime, as in + + fgfs --aircraft=c172 + +or + + fgfs --aircraft=uiuc --aircraft-dir=Aircraft-uiuc/Boeing747 + +I did this so that I could play with the UIUC stuff without losing +Tony's C172 with its flaps, etc. I did my best to respect the design +of the LaRCsim code by staying in C, making only minimal changes, and +not introducing any dependencies on the rest of FlightGear. The +modified files are attached. + +Revision 1.1.1.1 1999/06/17 18:07:34 curt +Start of 0.7.x branch Revision 1.1.1.1 1999/04/05 21:32:45 curt Start of 0.6.x branch. @@ -112,6 +128,7 @@ static char rcsid[] = "$Id$"; #include "ls_step.h" #include "ls_init.h" #include "navion_init.h" +#include "ls_model.h" /* temp */ #include "ls_generic.h" @@ -200,11 +217,28 @@ void ls_init_init( void ) { */ } -void ls_init( void ) { +void ls_init( char * aircraft ) { /* int i; */ Simtime = 0; + if (!strcasecmp(aircraft, "c172")) { + printf("Initializing LaRCsim for C172\n"); + current_model = C172; + } else if (!strcasecmp(aircraft, "navion")) { + printf("Initializing LaRCsim for Navion\n"); + current_model = NAVION; + } else if (!strcasecmp(aircraft, "cherokee")) { + printf("Initializing LaRCsim for Cherokee\n"); + current_model = CHEROKEE; + } else if (!strcasecmp(aircraft, "uiuc")) { + printf("Initializing LaRCsim for UIUC models\n"); + current_model = UIUC; + } else { + printf("Unknown LaRCsim aircraft: %s; defaulting to C172\n", aircraft); + current_model = C172; + } + /* printf("LS in init() pos = %.2f\n", Latitude); */ ls_init_init(); @@ -224,8 +258,21 @@ void ls_init( void ) { ls_set_sym_val( &Discrete_States[i].Symbol, (double) Discrete_States[i].value ); */ - - model_init(); + + switch (current_model) { + case NAVION: + navion_init(); + break; + case C172: + c172_init(); + break; + case CHEROKEE: + cherokee_init(); + break; + case UIUC: + c172_init(); + break; + } /* printf("LS after model_init() pos = %.2f\n", Latitude); */ diff --git a/src/FDM/LaRCsim/ls_init.h b/src/FDM/LaRCsim/ls_init.h index 06188f432..94991cf90 100644 --- a/src/FDM/LaRCsim/ls_init.h +++ b/src/FDM/LaRCsim/ls_init.h @@ -5,7 +5,7 @@ #define _LS_INIT_H -void ls_init( void ); +void ls_init( char * aircraft ); #endif /* _LS_INIT_H */ diff --git a/src/FDM/LaRCsim/ls_interface.c b/src/FDM/LaRCsim/ls_interface.c index bf5bc1961..f95ff9b4a 100644 --- a/src/FDM/LaRCsim/ls_interface.c +++ b/src/FDM/LaRCsim/ls_interface.c @@ -521,7 +521,7 @@ int ls_cockpit( void ) { /* Initialize the LaRCsim flight model, dt is the time increment for each subsequent iteration through the EOM */ -int ls_toplevel_init(double dt) { +int ls_toplevel_init(double dt, char * aircraft) { model_dt = dt; ls_setdefopts(); /* set default options */ @@ -535,7 +535,7 @@ int ls_toplevel_init(double dt) { /* printf("LS pre Init pos = %.2f\n", Latitude); */ - ls_init(); + ls_init(aircraft); /* printf("LS post Init pos = %.2f\n", Latitude); */ @@ -575,8 +575,24 @@ int ls_ForceAltitude(double alt_feet) { /* Flight Gear Modification Log * * $Log$ - * Revision 1.1 1999/06/17 18:07:33 curt - * Initial revision + * Revision 1.2 2000/04/10 18:09:41 curt + * David Megginson made a few (mostly minor) mods to the LaRCsim files, and + * it's now possible to choose the LaRCsim model at runtime, as in + * + * fgfs --aircraft=c172 + * + * or + * + * fgfs --aircraft=uiuc --aircraft-dir=Aircraft-uiuc/Boeing747 + * + * I did this so that I could play with the UIUC stuff without losing + * Tony's C172 with its flaps, etc. I did my best to respect the design + * of the LaRCsim code by staying in C, making only minimal changes, and + * not introducing any dependencies on the rest of FlightGear. The + * modified files are attached. + * + * Revision 1.1.1.1 1999/06/17 18:07:33 curt + * Start of 0.7.x branch * * Revision 1.2 1999/04/27 19:28:04 curt * Changes for the MacOS port contributed by Darrell Walisser. diff --git a/src/FDM/LaRCsim/ls_interface.h b/src/FDM/LaRCsim/ls_interface.h index b5b110559..7b1911544 100644 --- a/src/FDM/LaRCsim/ls_interface.h +++ b/src/FDM/LaRCsim/ls_interface.h @@ -37,7 +37,7 @@ extern "C" { /* reset flight params to a specific position */ -int ls_toplevel_init(double dt); +int ls_toplevel_init(double dt, char * aircraft); /* update position based on inputs, positions, velocities, etc. */ int ls_update(int multiloop); @@ -65,8 +65,24 @@ int ls_ForceAltitude(double alt_feet); // $Log$ -// Revision 1.1 1999/06/17 18:07:33 curt -// Initial revision +// Revision 1.2 2000/04/10 18:09:41 curt +// David Megginson made a few (mostly minor) mods to the LaRCsim files, and +// it's now possible to choose the LaRCsim model at runtime, as in +// +// fgfs --aircraft=c172 +// +// or +// +// fgfs --aircraft=uiuc --aircraft-dir=Aircraft-uiuc/Boeing747 +// +// I did this so that I could play with the UIUC stuff without losing +// Tony's C172 with its flaps, etc. I did my best to respect the design +// of the LaRCsim code by staying in C, making only minimal changes, and +// not introducing any dependencies on the rest of FlightGear. The +// modified files are attached. +// +// Revision 1.1.1.1 1999/06/17 18:07:33 curt +// Start of 0.7.x branch // // Revision 1.1.1.1 1999/04/05 21:32:45 curt // Start of 0.6.x branch. diff --git a/src/FDM/LaRCsim/ls_model.c b/src/FDM/LaRCsim/ls_model.c index a9fcd706f..0a5da7d1d 100644 --- a/src/FDM/LaRCsim/ls_model.c +++ b/src/FDM/LaRCsim/ls_model.c @@ -37,8 +37,24 @@ CURRENT RCS HEADER INFO: $Header$ $Log$ -Revision 1.1 1999/06/17 18:07:33 curt -Initial revision +Revision 1.2 2000/04/10 18:09:41 curt +David Megginson made a few (mostly minor) mods to the LaRCsim files, and +it's now possible to choose the LaRCsim model at runtime, as in + + fgfs --aircraft=c172 + +or + + fgfs --aircraft=uiuc --aircraft-dir=Aircraft-uiuc/Boeing747 + +I did this so that I could play with the UIUC stuff without losing +Tony's C172 with its flaps, etc. I did my best to respect the design +of the LaRCsim code by staying in C, making only minimal changes, and +not introducing any dependencies on the rest of FlightGear. The +modified files are attached. + +Revision 1.1.1.1 1999/06/17 18:07:33 curt +Start of 0.7.x branch Revision 1.1.1.1 1999/04/05 21:32:45 curt Start of 0.6.x branch. @@ -90,11 +106,38 @@ Initial Flight Gear revision. #include "ls_model.h" #include "default_model_routines.h" +Model current_model; + void ls_model( SCALAR dt, int Initialize ) { - inertias( dt, Initialize ); - subsystems( dt, Initialize ); - aero( dt, Initialize ); - engine( dt, Initialize ); - gear( dt, Initialize ); + switch (current_model) { + case NAVION: + inertias( dt, Initialize ); + subsystems( dt, Initialize ); + navion_aero( dt, Initialize ); + navion_engine( dt, Initialize ); + navion_gear( dt, Initialize ); + break; + case C172: + inertias( dt, Initialize ); + subsystems( dt, Initialize ); + c172_aero( dt, Initialize ); + c172_engine( dt, Initialize ); + c172_gear( dt, Initialize ); + break; + case CHEROKEE: + inertias( dt, Initialize ); + subsystems( dt, Initialize ); + cherokee_aero( dt, Initialize ); + cherokee_engine( dt, Initialize ); + cherokee_gear( dt, Initialize ); + break; + case UIUC: + inertias( dt, Initialize ); + subsystems( dt, Initialize ); + uiuc_aero( dt, Initialize ); + uiuc_engine( dt, Initialize ); + uiuc_gear( dt, Initialize ); + break; + } } diff --git a/src/FDM/LaRCsim/ls_model.h b/src/FDM/LaRCsim/ls_model.h index cb0d0321f..9dfb63604 100644 --- a/src/FDM/LaRCsim/ls_model.h +++ b/src/FDM/LaRCsim/ls_model.h @@ -4,6 +4,15 @@ #ifndef _LS_MODEL_H #define _LS_MODEL_H +typedef enum { + NAVION, + C172, + CHEROKEE, + UIUC +} Model; + +extern Model current_model; + void ls_model( SCALAR dt, int Initialize ); diff --git a/src/FDM/LaRCsim/navion_aero.c b/src/FDM/LaRCsim/navion_aero.c index 6839e457c..9ea3f921a 100644 --- a/src/FDM/LaRCsim/navion_aero.c +++ b/src/FDM/LaRCsim/navion_aero.c @@ -112,7 +112,7 @@ ring is given below: extern COCKPIT cockpit_; -void aero( SCALAR dt, int Initialize ) { +void navion_aero( SCALAR dt, int Initialize ) { static int init = 0; SCALAR u, w; diff --git a/src/FDM/LaRCsim/navion_engine.c b/src/FDM/LaRCsim/navion_engine.c index d1ae9018e..0870a8357 100644 --- a/src/FDM/LaRCsim/navion_engine.c +++ b/src/FDM/LaRCsim/navion_engine.c @@ -66,7 +66,7 @@ $Header$ extern SIM_CONTROL sim_control_; -void engine( SCALAR dt, int init ) { +void navion_engine( SCALAR dt, int init ) { /* if (init) { */ Throttle[3] = Throttle_pct; /* } */ diff --git a/src/FDM/LaRCsim/navion_gear.c b/src/FDM/LaRCsim/navion_gear.c index 8959fe3ea..91de63c52 100644 --- a/src/FDM/LaRCsim/navion_gear.c +++ b/src/FDM/LaRCsim/navion_gear.c @@ -36,8 +36,24 @@ $Header$ $Log$ -Revision 1.1 1999/06/17 18:07:34 curt -Initial revision +Revision 1.2 2000/04/10 18:09:41 curt +David Megginson made a few (mostly minor) mods to the LaRCsim files, and +it's now possible to choose the LaRCsim model at runtime, as in + + fgfs --aircraft=c172 + +or + + fgfs --aircraft=uiuc --aircraft-dir=Aircraft-uiuc/Boeing747 + +I did this so that I could play with the UIUC stuff without losing +Tony's C172 with its flaps, etc. I did my best to respect the design +of the LaRCsim code by staying in C, making only minimal changes, and +not introducing any dependencies on the rest of FlightGear. The +modified files are attached. + +Revision 1.1.1.1 1999/06/17 18:07:34 curt +Start of 0.7.x branch Revision 1.1.1.1 1999/04/05 21:32:45 curt Start of 0.6.x branch. @@ -93,47 +109,47 @@ Initial Flight Gear revision. #include "ls_cockpit.h" -void sub3( DATA v1[], DATA v2[], DATA result[] ) +static void sub3( DATA v1[], DATA v2[], DATA result[] ) { result[0] = v1[0] - v2[0]; result[1] = v1[1] - v2[1]; result[2] = v1[2] - v2[2]; } -void add3( DATA v1[], DATA v2[], DATA result[] ) +static void add3( DATA v1[], DATA v2[], DATA result[] ) { result[0] = v1[0] + v2[0]; result[1] = v1[1] + v2[1]; result[2] = v1[2] + v2[2]; } -void cross3( DATA v1[], DATA v2[], DATA result[] ) +static void cross3( DATA v1[], DATA v2[], DATA result[] ) { result[0] = v1[1]*v2[2] - v1[2]*v2[1]; result[1] = v1[2]*v2[0] - v1[0]*v2[2]; result[2] = v1[0]*v2[1] - v1[1]*v2[0]; } -void multtrans3x3by3( DATA m[][3], DATA v[], DATA result[] ) +static void multtrans3x3by3( DATA m[][3], DATA v[], DATA result[] ) { result[0] = m[0][0]*v[0] + m[1][0]*v[1] + m[2][0]*v[2]; result[1] = m[0][1]*v[0] + m[1][1]*v[1] + m[2][1]*v[2]; result[2] = m[0][2]*v[0] + m[1][2]*v[1] + m[2][2]*v[2]; } -void mult3x3by3( DATA m[][3], DATA v[], DATA result[] ) +static void mult3x3by3( DATA m[][3], DATA v[], DATA result[] ) { result[0] = m[0][0]*v[0] + m[0][1]*v[1] + m[0][2]*v[2]; result[1] = m[1][0]*v[0] + m[1][1]*v[1] + m[1][2]*v[2]; result[2] = m[2][0]*v[0] + m[2][1]*v[1] + m[2][2]*v[2]; } -void clear3( DATA v[] ) +static void clear3( DATA v[] ) { v[0] = 0.; v[1] = 0.; v[2] = 0.; } -void gear( SCALAR dt, int Initialize ) { +void navion_gear( SCALAR dt, int Initialize ) { char rcsid[] = "$Id$"; /* diff --git a/src/FDM/LaRCsim/navion_init.c b/src/FDM/LaRCsim/navion_init.c index 286c11d1a..2f7c6e483 100644 --- a/src/FDM/LaRCsim/navion_init.c +++ b/src/FDM/LaRCsim/navion_init.c @@ -60,7 +60,7 @@ #include "ls_generic.h" #include "ls_cockpit.h" -void model_init( void ) { +void navion_init( void ) { Throttle[3] = 0.2; Rudder_pedal = 0; Lat_control = 0; Long_control = 0; diff --git a/src/FDM/LaRCsim/navion_init.h b/src/FDM/LaRCsim/navion_init.h index f7d097e14..0bb54a823 100644 --- a/src/FDM/LaRCsim/navion_init.h +++ b/src/FDM/LaRCsim/navion_init.h @@ -5,7 +5,7 @@ #define _NAVION_INIT_H -void model_init( void ); +void navion_init( void ); #endif _NAVION_INIT_H diff --git a/src/FDM/LaRCsim/uiuc_aero.c b/src/FDM/LaRCsim/uiuc_aero.c index bf6b12c89..e33c3b8c1 100644 --- a/src/FDM/LaRCsim/uiuc_aero.c +++ b/src/FDM/LaRCsim/uiuc_aero.c @@ -57,7 +57,7 @@ #include -void aero( SCALAR dt, int Initialize ) +void uiuc_aero( SCALAR dt, int Initialize ) { static int init = 0; @@ -71,7 +71,7 @@ void aero( SCALAR dt, int Initialize ) } -void engine( SCALAR dt, int Initialize ) +void uiuc_engine( SCALAR dt, int Initialize ) { uiuc_engine_routine(); } @@ -81,47 +81,47 @@ void engine( SCALAR dt, int Initialize ) * added later and the choice of the gear model could be specified at * runtime. * ***********************************************************************/ -sub3( DATA v1[], DATA v2[], DATA result[] ) +static sub3( DATA v1[], DATA v2[], DATA result[] ) { result[0] = v1[0] - v2[0]; result[1] = v1[1] - v2[1]; result[2] = v1[2] - v2[2]; } -add3( DATA v1[], DATA v2[], DATA result[] ) +static add3( DATA v1[], DATA v2[], DATA result[] ) { result[0] = v1[0] + v2[0]; result[1] = v1[1] + v2[1]; result[2] = v1[2] + v2[2]; } -cross3( DATA v1[], DATA v2[], DATA result[] ) +static cross3( DATA v1[], DATA v2[], DATA result[] ) { result[0] = v1[1]*v2[2] - v1[2]*v2[1]; result[1] = v1[2]*v2[0] - v1[0]*v2[2]; result[2] = v1[0]*v2[1] - v1[1]*v2[0]; } -multtrans3x3by3( DATA m[][3], DATA v[], DATA result[] ) +static multtrans3x3by3( DATA m[][3], DATA v[], DATA result[] ) { result[0] = m[0][0]*v[0] + m[1][0]*v[1] + m[2][0]*v[2]; result[1] = m[0][1]*v[0] + m[1][1]*v[1] + m[2][1]*v[2]; result[2] = m[0][2]*v[0] + m[1][2]*v[1] + m[2][2]*v[2]; } -mult3x3by3( DATA m[][3], DATA v[], DATA result[] ) +static mult3x3by3( DATA m[][3], DATA v[], DATA result[] ) { result[0] = m[0][0]*v[0] + m[0][1]*v[1] + m[0][2]*v[2]; result[1] = m[1][0]*v[0] + m[1][1]*v[1] + m[1][2]*v[2]; result[2] = m[2][0]*v[0] + m[2][1]*v[1] + m[2][2]*v[2]; } -clear3( DATA v[] ) +static clear3( DATA v[] ) { v[0] = 0.; v[1] = 0.; v[2] = 0.; } -gear() +uiuc_gear() { char rcsid[] = "$Id$";