1
0
Fork 0

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.
This commit is contained in:
curt 2000-04-10 20:09:40 +00:00
parent d9c7848ed7
commit 1f1b2bab50
23 changed files with 255 additions and 91 deletions

View file

@ -50,7 +50,7 @@ int FGLaRCsim::init( double dt ) {
copy_to_LaRCsim(); copy_to_LaRCsim();
// actual LaRCsim top level init // 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 = " << FG_LOG( FG_FLIGHT, FG_INFO, "FG pos = " <<
get_Latitude() ); get_Latitude() );

View file

@ -6,26 +6,11 @@ EXTRA_DIST = \
navion_init.h \ navion_init.h \
uiuc_aero.c uiuc_aero.c
if ENABLE_NAVION AIRCRAFT_MODEL = c172_aero.c c172_engine.c c172_gear.c c172_init.c \
NAVION_MODEL = \ navion_init.h navion_aero.c navion_engine.c \
navion_aero.c navion_engine.c navion_gear.c navion_init.c navion_init.h navion_gear.c navion_init.c uiuc_aero.c \
else cherokee_aero.c cherokee_engine.c cherokee_gear.c \
NAVION_MODEL = cherokee_init.c
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
noinst_LIBRARIES = libLaRCsim.a noinst_LIBRARIES = libLaRCsim.a
@ -43,7 +28,7 @@ libLaRCsim_a_SOURCES = \
ls_sim_control.h \ ls_sim_control.h \
ls_step.c ls_step.h \ ls_step.c ls_step.h \
ls_sym.h ls_types.h \ ls_sym.h ls_types.h \
$(NAVION_MODEL) $(C172_MODEL) $(UIUC_MODEL) \ $(AIRCRAFT_MODEL) \
ls_interface.c ls_interface.h ls_interface.c ls_interface.h
INCLUDES += -I$(top_builddir) -I$(top_builddir)/src INCLUDES += -I$(top_builddir) -I$(top_builddir)/src

View file

@ -109,7 +109,7 @@
extern COCKPIT cockpit_; 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; SCALAR slope;
int i=1; 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; static int init = 0;

View file

@ -69,7 +69,7 @@ $Header$
extern SIM_CONTROL sim_control_; extern SIM_CONTROL sim_control_;
void engine( SCALAR dt, int init ) { void c172_engine( SCALAR dt, int init ) {
float v,h,pa; float v,h,pa;
float bhp=160; float bhp=160;

View file

@ -36,6 +36,22 @@
$Header$ $Header$
$Log$ $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 Revision 1.13 1999/12/13 20:43:41 curt
Updates from Tony. Updates from Tony.
@ -70,47 +86,47 @@ Updates from Tony.
#define HEIGHT_AGL_WHEEL d_wheel_rwy_local_v[2] #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[0] = v1[0] - v2[0];
result[1] = v1[1] - v2[1]; result[1] = v1[1] - v2[1];
result[2] = v1[2] - v2[2]; 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[0] = v1[0] + v2[0];
result[1] = v1[1] + v2[1]; result[1] = v1[1] + v2[1];
result[2] = v1[2] + v2[2]; 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[0] = v1[1]*v2[2] - v1[2]*v2[1];
result[1] = v1[2]*v2[0] - v1[0]*v2[2]; result[1] = v1[2]*v2[0] - v1[0]*v2[2];
result[2] = v1[0]*v2[1] - v1[1]*v2[0]; 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[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[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]; 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[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[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]; 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.; v[0] = 0.; v[1] = 0.; v[2] = 0.;
} }
gear() c172_gear()
{ {
char rcsid[] = "$Id$"; char rcsid[] = "$Id$";
#define NUM_WHEELS 4 #define NUM_WHEELS 4

View file

@ -62,7 +62,7 @@
#include "ls_constants.h" #include "ls_constants.h"
#include "c172_aero.h" #include "c172_aero.h"
void model_init( void ) { void c172_init( void ) {
Throttle[3] = 0.2; Throttle[3] = 0.2;

View file

@ -1,11 +1,11 @@
/* a quick navion_init.h */ /* a quick navion_init.h */
#ifndef _NAVION_INIT_H #ifndef _C172_INIT_H
#define _NAVION_INIT_H #define _C172_INIT_H
void model_init( void ); void c172_init( void );
#endif _NAVION_INIT_H #endif _C172_INIT_H

View file

@ -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)*/ /*float ** Cherokee (float t, VectorStanja &X, float *U)*/
{ {
static float static float

View file

@ -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 static float

View file

@ -36,8 +36,24 @@
$Header$ $Header$
$Log$ $Log$
Revision 1.1 1999/06/17 18:07:34 curt Revision 1.2 2000/04/10 18:09:41 curt
Initial revision 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 Revision 1.1.1.1 1999/04/05 21:32:45 curt
Start of 0.6.x branch. Start of 0.6.x branch.
@ -71,47 +87,47 @@ Start of 0.6.x branch.
#include "ls_cockpit.h" #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[0] = v1[0] - v2[0];
result[1] = v1[1] - v2[1]; result[1] = v1[1] - v2[1];
result[2] = v1[2] - v2[2]; 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[0] = v1[0] + v2[0];
result[1] = v1[1] + v2[1]; result[1] = v1[1] + v2[1];
result[2] = v1[2] + v2[2]; 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[0] = v1[1]*v2[2] - v1[2]*v2[1];
result[1] = v1[2]*v2[0] - v1[0]*v2[2]; result[1] = v1[2]*v2[0] - v1[0]*v2[2];
result[2] = v1[0]*v2[1] - v1[1]*v2[0]; 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[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[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]; 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[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[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]; 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.; v[0] = 0.; v[1] = 0.; v[2] = 0.;
} }
void gear() void cherokee_gear()
{ {
char rcsid[] = "$Id$"; char rcsid[] = "$Id$";

View file

@ -48,7 +48,7 @@
#include "ls_generic.h" #include "ls_generic.h"
#include "ls_cockpit.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; Throttle[3] = 0.2; Rudder_pedal = 0; Lat_control = 0; Long_control = 0;

View file

@ -34,8 +34,24 @@
$Header$ $Header$
$Log$ $Log$
Revision 1.1 1999/06/17 18:07:34 curt Revision 1.2 2000/04/10 18:09:41 curt
Initial revision 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 Revision 1.1.1.1 1999/04/05 21:32:45 curt
Start of 0.6.x branch. Start of 0.6.x branch.
@ -112,6 +128,7 @@ static char rcsid[] = "$Id$";
#include "ls_step.h" #include "ls_step.h"
#include "ls_init.h" #include "ls_init.h"
#include "navion_init.h" #include "navion_init.h"
#include "ls_model.h"
/* temp */ /* temp */
#include "ls_generic.h" #include "ls_generic.h"
@ -200,11 +217,28 @@ void ls_init_init( void ) {
*/ */
} }
void ls_init( void ) { void ls_init( char * aircraft ) {
/* int i; */ /* int i; */
Simtime = 0; 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); */ /* printf("LS in init() pos = %.2f\n", Latitude); */
ls_init_init(); ls_init_init();
@ -225,7 +259,20 @@ void ls_init( void ) {
(double) Discrete_States[i].value ); (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); */ /* printf("LS after model_init() pos = %.2f\n", Latitude); */

View file

@ -5,7 +5,7 @@
#define _LS_INIT_H #define _LS_INIT_H
void ls_init( void ); void ls_init( char * aircraft );
#endif /* _LS_INIT_H */ #endif /* _LS_INIT_H */

View file

@ -521,7 +521,7 @@ int ls_cockpit( void ) {
/* Initialize the LaRCsim flight model, dt is the time increment for /* Initialize the LaRCsim flight model, dt is the time increment for
each subsequent iteration through the EOM */ each subsequent iteration through the EOM */
int ls_toplevel_init(double dt) { int ls_toplevel_init(double dt, char * aircraft) {
model_dt = dt; model_dt = dt;
ls_setdefopts(); /* set default options */ ls_setdefopts(); /* set default options */
@ -535,7 +535,7 @@ int ls_toplevel_init(double dt) {
/* printf("LS pre Init pos = %.2f\n", Latitude); */ /* printf("LS pre Init pos = %.2f\n", Latitude); */
ls_init(); ls_init(aircraft);
/* printf("LS post Init pos = %.2f\n", Latitude); */ /* printf("LS post Init pos = %.2f\n", Latitude); */
@ -575,8 +575,24 @@ int ls_ForceAltitude(double alt_feet) {
/* Flight Gear Modification Log /* Flight Gear Modification Log
* *
* $Log$ * $Log$
* Revision 1.1 1999/06/17 18:07:33 curt * Revision 1.2 2000/04/10 18:09:41 curt
* Initial revision * 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 * Revision 1.2 1999/04/27 19:28:04 curt
* Changes for the MacOS port contributed by Darrell Walisser. * Changes for the MacOS port contributed by Darrell Walisser.

View file

@ -37,7 +37,7 @@ extern "C" {
/* reset flight params to a specific position */ /* 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. */ /* update position based on inputs, positions, velocities, etc. */
int ls_update(int multiloop); int ls_update(int multiloop);
@ -65,8 +65,24 @@ int ls_ForceAltitude(double alt_feet);
// $Log$ // $Log$
// Revision 1.1 1999/06/17 18:07:33 curt // Revision 1.2 2000/04/10 18:09:41 curt
// Initial revision // 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 // Revision 1.1.1.1 1999/04/05 21:32:45 curt
// Start of 0.6.x branch. // Start of 0.6.x branch.

View file

@ -37,8 +37,24 @@
CURRENT RCS HEADER INFO: CURRENT RCS HEADER INFO:
$Header$ $Header$
$Log$ $Log$
Revision 1.1 1999/06/17 18:07:33 curt Revision 1.2 2000/04/10 18:09:41 curt
Initial revision 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 Revision 1.1.1.1 1999/04/05 21:32:45 curt
Start of 0.6.x branch. Start of 0.6.x branch.
@ -90,11 +106,38 @@ Initial Flight Gear revision.
#include "ls_model.h" #include "ls_model.h"
#include "default_model_routines.h" #include "default_model_routines.h"
Model current_model;
void ls_model( SCALAR dt, int Initialize ) { void ls_model( SCALAR dt, int Initialize ) {
inertias( dt, Initialize ); switch (current_model) {
subsystems( dt, Initialize ); case NAVION:
aero( dt, Initialize ); inertias( dt, Initialize );
engine( dt, Initialize ); subsystems( dt, Initialize );
gear( 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;
}
} }

View file

@ -4,6 +4,15 @@
#ifndef _LS_MODEL_H #ifndef _LS_MODEL_H
#define _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 ); void ls_model( SCALAR dt, int Initialize );

View file

@ -112,7 +112,7 @@ ring is given below:
extern COCKPIT cockpit_; extern COCKPIT cockpit_;
void aero( SCALAR dt, int Initialize ) { void navion_aero( SCALAR dt, int Initialize ) {
static int init = 0; static int init = 0;
SCALAR u, w; SCALAR u, w;

View file

@ -66,7 +66,7 @@ $Header$
extern SIM_CONTROL sim_control_; extern SIM_CONTROL sim_control_;
void engine( SCALAR dt, int init ) { void navion_engine( SCALAR dt, int init ) {
/* if (init) { */ /* if (init) { */
Throttle[3] = Throttle_pct; Throttle[3] = Throttle_pct;
/* } */ /* } */

View file

@ -36,8 +36,24 @@
$Header$ $Header$
$Log$ $Log$
Revision 1.1 1999/06/17 18:07:34 curt Revision 1.2 2000/04/10 18:09:41 curt
Initial revision 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 Revision 1.1.1.1 1999/04/05 21:32:45 curt
Start of 0.6.x branch. Start of 0.6.x branch.
@ -93,47 +109,47 @@ Initial Flight Gear revision.
#include "ls_cockpit.h" #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[0] = v1[0] - v2[0];
result[1] = v1[1] - v2[1]; result[1] = v1[1] - v2[1];
result[2] = v1[2] - v2[2]; 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[0] = v1[0] + v2[0];
result[1] = v1[1] + v2[1]; result[1] = v1[1] + v2[1];
result[2] = v1[2] + v2[2]; 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[0] = v1[1]*v2[2] - v1[2]*v2[1];
result[1] = v1[2]*v2[0] - v1[0]*v2[2]; result[1] = v1[2]*v2[0] - v1[0]*v2[2];
result[2] = v1[0]*v2[1] - v1[1]*v2[0]; 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[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[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]; 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[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[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]; 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.; 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$"; char rcsid[] = "$Id$";
/* /*

View file

@ -60,7 +60,7 @@
#include "ls_generic.h" #include "ls_generic.h"
#include "ls_cockpit.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; Throttle[3] = 0.2; Rudder_pedal = 0; Lat_control = 0; Long_control = 0;

View file

@ -5,7 +5,7 @@
#define _NAVION_INIT_H #define _NAVION_INIT_H
void model_init( void ); void navion_init( void );
#endif _NAVION_INIT_H #endif _NAVION_INIT_H

View file

@ -57,7 +57,7 @@
#include <FDM/UIUCModel/uiuc_wrapper.h> #include <FDM/UIUCModel/uiuc_wrapper.h>
void aero( SCALAR dt, int Initialize ) void uiuc_aero( SCALAR dt, int Initialize )
{ {
static int init = 0; 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(); 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 * added later and the choice of the gear model could be specified at
* runtime. * runtime.
* ***********************************************************************/ * ***********************************************************************/
sub3( DATA v1[], DATA v2[], DATA result[] ) static sub3( DATA v1[], DATA v2[], DATA result[] )
{ {
result[0] = v1[0] - v2[0]; result[0] = v1[0] - v2[0];
result[1] = v1[1] - v2[1]; result[1] = v1[1] - v2[1];
result[2] = v1[2] - v2[2]; 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[0] = v1[0] + v2[0];
result[1] = v1[1] + v2[1]; result[1] = v1[1] + v2[1];
result[2] = v1[2] + v2[2]; 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[0] = v1[1]*v2[2] - v1[2]*v2[1];
result[1] = v1[2]*v2[0] - v1[0]*v2[2]; result[1] = v1[2]*v2[0] - v1[0]*v2[2];
result[2] = v1[0]*v2[1] - v1[1]*v2[0]; 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[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[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]; 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[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[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]; 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.; v[0] = 0.; v[1] = 0.; v[2] = 0.;
} }
gear() uiuc_gear()
{ {
char rcsid[] = "$Id$"; char rcsid[] = "$Id$";