1
0
Fork 0

UIUC code initilization mods to tidy things up a bit.

This commit is contained in:
mselig 2003-07-25 17:53:35 +00:00
parent 9f518ef343
commit 2606555bf6
5 changed files with 59 additions and 18 deletions

View file

@ -34,8 +34,11 @@
$Header$ $Header$
$Log$ $Log$
Revision 1.1 2002/09/10 01:14:02 curt Revision 1.2 2003/07/25 17:53:35 mselig
Initial revision UIUC code initilization mods to tidy things up a bit.
Revision 1.1.1.1 2002/09/10 01:14:02 curt
Initial revision of FlightGear-0.9.0
Revision 1.3 2000/05/24 04:10:01 curt Revision 1.3 2000/05/24 04:10:01 curt
MSVC5 portability changes contributed by Bruce Finney. MSVC5 portability changes contributed by Bruce Finney.
@ -149,6 +152,7 @@ static char rcsid[] = "$Id$";
void cherokee_init( void ); void cherokee_init( void );
void c172_init( void ); void c172_init( void );
void basic_init( void );
typedef struct typedef struct
{ {
@ -245,6 +249,9 @@ void ls_init( char * aircraft ) {
} else if (!strcasecmp(aircraft, "cherokee")) { } else if (!strcasecmp(aircraft, "cherokee")) {
printf("Initializing LaRCsim for Cherokee\n"); printf("Initializing LaRCsim for Cherokee\n");
current_model = CHEROKEE; current_model = CHEROKEE;
} else if (!strcasecmp(aircraft, "basic")) {
printf("Initializing LaRCsim for Basic\n");
current_model = BASIC;
} else if (!strcasecmp(aircraft, "uiuc")) { } else if (!strcasecmp(aircraft, "uiuc")) {
printf("Initializing LaRCsim for UIUC models\n"); printf("Initializing LaRCsim for UIUC models\n");
current_model = UIUC; current_model = UIUC;
@ -283,6 +290,9 @@ void ls_init( char * aircraft ) {
case CHEROKEE: case CHEROKEE:
cherokee_init(); cherokee_init();
break; break;
case BASIC:
basic_init();
break;
case UIUC: case UIUC:
c172_init(); c172_init();
break; break;

View file

@ -37,6 +37,9 @@
CURRENT RCS HEADER INFO: CURRENT RCS HEADER INFO:
$Header$ $Header$
$Log$ $Log$
Revision 1.4 2003/07/25 17:53:41 mselig
UIUC code initilization mods to tidy things up a bit.
Revision 1.3 2003/05/13 18:45:06 curt Revision 1.3 2003/05/13 18:45:06 curt
Robert Deters: Robert Deters:
@ -168,6 +171,7 @@ void ls_model( SCALAR dt, int Initialize ) {
navion_gear( dt, Initialize ); navion_gear( dt, Initialize );
break; break;
case C172: case C172:
printf("here we are in C172 \n");
if(Initialize < 0) c172_init(); if(Initialize < 0) c172_init();
inertias( dt, Initialize ); inertias( dt, Initialize );
subsystems( dt, Initialize ); subsystems( dt, Initialize );
@ -182,10 +186,22 @@ void ls_model( SCALAR dt, int Initialize ) {
cherokee_engine( dt, Initialize ); cherokee_engine( dt, Initialize );
cherokee_gear( dt, Initialize ); cherokee_gear( dt, Initialize );
break; break;
case BASIC:
// printf("here we are in BASIC \n");
if(Initialize < 0) basic_init();
printf("Initialize %d \n", Initialize);
inertias( dt, Initialize );
subsystems( dt, Initialize );
basic_aero( dt, Initialize );
basic_engine( dt, Initialize );
basic_gear( dt, Initialize );
break;
case UIUC: case UIUC:
inertias( dt, Initialize ); inertias( dt, Initialize );
subsystems( dt, Initialize ); subsystems( dt, Initialize );
uiuc_init_2_wrapper(); // During initialization period, re-initialize velocities
// and euler angles
if (Initialize !=0) uiuc_init_2_wrapper();
uiuc_network_recv_2_wrapper(); uiuc_network_recv_2_wrapper();
uiuc_engine_2_wrapper( dt, Initialize ); uiuc_engine_2_wrapper( dt, Initialize );
uiuc_wind_2_wrapper( dt, Initialize ); uiuc_wind_2_wrapper( dt, Initialize );

View file

@ -8,6 +8,7 @@ typedef enum {
NAVION, NAVION,
C172, C172,
CHEROKEE, CHEROKEE,
BASIC,
UIUC UIUC
} Model; } Model;

View file

@ -50,6 +50,9 @@
$Header$ $Header$
$Log$ $Log$
Revision 1.5 2003/07/25 17:53:47 mselig
UIUC code initilization mods to tidy things up a bit.
Revision 1.4 2003/06/20 19:53:56 ehofman Revision 1.4 2003/06/20 19:53:56 ehofman
Get rid of a multiple defined symbol warning" src/FDM/LaRCsim/ls_step.c Get rid of a multiple defined symbol warning" src/FDM/LaRCsim/ls_step.c
" "
@ -294,7 +297,7 @@ Initial Flight Gear revision.
--------------------------------------------------------------------------*/ --------------------------------------------------------------------------*/
#include <FDM/UIUCModel/uiuc_wrapper.h> //#include <FDM/UIUCModel/uiuc_wrapper.h>
#include "ls_types.h" #include "ls_types.h"
#include "ls_constants.h" #include "ls_constants.h"
@ -361,11 +364,9 @@ void ls_step( SCALAR dt, int Initialize ) {
V_east = V_east + local_gnd_veast; V_east = V_east + local_gnd_veast;
/* Initialize quaternions and transformation matrix from Euler angles */ /* Initialize quaternions and transformation matrix from Euler angles */
if (current_model == UIUC && Simtime == 0) { // Initialize UIUC aircraft model
if (inited == 0) { if (current_model == UIUC) {
uiuc_defaults_inits(); uiuc_init_2_wrapper();
}
uiuc_init_vars();
} }
e_0 = cos(Psi*0.5)*cos(Theta*0.5)*cos(Phi*0.5) e_0 = cos(Psi*0.5)*cos(Theta*0.5)*cos(Phi*0.5)
@ -386,9 +387,11 @@ void ls_step( SCALAR dt, int Initialize ) {
T_local_to_body_32 = 2*(e_2*e_3 - e_0*e_1); T_local_to_body_32 = 2*(e_2*e_3 - e_0*e_1);
T_local_to_body_33 = e_0*e_0 - e_1*e_1 - e_2*e_2 + e_3*e_3; T_local_to_body_33 = e_0*e_0 - e_1*e_1 - e_2*e_2 + e_3*e_3;
if (current_model == UIUC && Simtime == 0) { // Initialize local velocities (V_north, V_east, V_down)
uiuc_vel_init(); // based on transformation matrix calculated above
} if (current_model == UIUC) {
uiuc_local_vel_init();
}
/* Calculate local gravitation acceleration */ /* Calculate local gravitation acceleration */

View file

@ -66,11 +66,21 @@ void uiuc_init_2_wrapper()
{ {
static int init = 0; static int init = 0;
if (init==0) // On first time through initialize UIUC aircraft model
{ if (init==0) {
init = -1; init=-1;
uiuc_initial_init(); uiuc_defaults_inits();
uiuc_init_aeromodel();
} }
// Re-initialize velocities and euler angles since LaRCsim tends
// to change them
uiuc_initial_init();
}
void uiuc_local_vel_init()
{
uiuc_vel_init();
} }
void uiuc_aero_2_wrapper( SCALAR dt, int Initialize ) void uiuc_aero_2_wrapper( SCALAR dt, int Initialize )
@ -81,6 +91,7 @@ void uiuc_aero_2_wrapper( SCALAR dt, int Initialize )
void uiuc_wind_2_wrapper( SCALAR dt, int Initialize ) void uiuc_wind_2_wrapper( SCALAR dt, int Initialize )
{ {
if (Initialize == 0)
uiuc_wind_routine(dt); uiuc_wind_routine(dt);
} }
@ -103,10 +114,10 @@ void uiuc_record_2_wrapper(SCALAR dt)
void uiuc_network_recv_2_wrapper() void uiuc_network_recv_2_wrapper()
{ {
uiuc_network_recv_routine(); uiuc_network_recv_routine();
} }
void uiuc_network_send_2_wrapper() void uiuc_network_send_2_wrapper()
{ {
uiuc_network_send_routine(); uiuc_network_send_routine();
} }