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() );
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
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
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;
}
-void aero( SCALAR dt, int Initialize ) {
+void c172_aero( SCALAR dt, int Initialize ) {
static int init = 0;
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;
$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.
#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
#include "ls_constants.h"
#include "c172_aero.h"
-void model_init( void ) {
+void c172_init( void ) {
Throttle[3] = 0.2;
/* 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
-void aero()
+void cherokee_aero()
/*float ** Cherokee (float t, VectorStanja &X, float *U)*/
{
static float
-void engine( SCALAR dt, int init )
+void cherokee_engine( SCALAR dt, int init )
{
static float
$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.
#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$";
#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;
$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.
#include "ls_step.h"
#include "ls_init.h"
#include "navion_init.h"
+#include "ls_model.h"
/* temp */
#include "ls_generic.h"
*/
}
-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();
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); */
#define _LS_INIT_H
-void ls_init( void );
+void ls_init( char * aircraft );
#endif /* _LS_INIT_H */
/* 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 */
/* printf("LS pre Init pos = %.2f\n", Latitude); */
- ls_init();
+ ls_init(aircraft);
/* printf("LS post Init pos = %.2f\n", Latitude); */
/* 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.
/* 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);
// $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.
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.
#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;
+ }
}
#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 );
extern COCKPIT cockpit_;
-void aero( SCALAR dt, int Initialize ) {
+void navion_aero( SCALAR dt, int Initialize ) {
static int init = 0;
SCALAR u, w;
extern SIM_CONTROL sim_control_;
-void engine( SCALAR dt, int init ) {
+void navion_engine( SCALAR dt, int init ) {
/* if (init) { */
Throttle[3] = Throttle_pct;
/* } */
$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.
#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$";
/*
#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;
#define _NAVION_INIT_H
-void model_init( void );
+void navion_init( void );
#endif _NAVION_INIT_H
#include <FDM/UIUCModel/uiuc_wrapper.h>
-void aero( SCALAR dt, int Initialize )
+void uiuc_aero( SCALAR dt, int Initialize )
{
static int init = 0;
}
-void engine( SCALAR dt, int Initialize )
+void uiuc_engine( SCALAR dt, int Initialize )
{
uiuc_engine_routine();
}
* 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$";