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:
parent
d9c7848ed7
commit
1f1b2bab50
23 changed files with 255 additions and 91 deletions
|
@ -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() );
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
#include "ls_constants.h"
|
||||
#include "c172_aero.h"
|
||||
|
||||
void model_init( void ) {
|
||||
void c172_init( void ) {
|
||||
|
||||
Throttle[3] = 0.2;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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$";
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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); */
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#define _LS_INIT_H
|
||||
|
||||
|
||||
void ls_init( void );
|
||||
void ls_init( char * aircraft );
|
||||
|
||||
|
||||
#endif /* _LS_INIT_H */
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
/* } */
|
||||
|
|
|
@ -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$";
|
||||
|
||||
/*
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#define _NAVION_INIT_H
|
||||
|
||||
|
||||
void model_init( void );
|
||||
void navion_init( void );
|
||||
|
||||
|
||||
#endif _NAVION_INIT_H
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
#include <FDM/UIUCModel/uiuc_wrapper.h>
|
||||
|
||||
|
||||
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$";
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue