]> git.mxchange.org Git - flightgear.git/commitdiff
UIUC code initilization mods to tidy things up a bit.
authormselig <mselig>
Fri, 25 Jul 2003 17:53:35 +0000 (17:53 +0000)
committermselig <mselig>
Fri, 25 Jul 2003 17:53:35 +0000 (17:53 +0000)
src/FDM/LaRCsim/ls_init.c
src/FDM/LaRCsim/ls_model.c
src/FDM/LaRCsim/ls_model.h
src/FDM/LaRCsim/ls_step.c
src/FDM/LaRCsim/uiuc_aero.c

index 0cef5fb366b3ebb16badc7c6983f3bee6f5f52ad..b249608c92cc45b1150cbfd669166657d127f6f9 100644 (file)
 
 $Header$
 $Log$
-Revision 1.1  2002/09/10 01:14:02  curt
-Initial revision
+Revision 1.2  2003/07/25 17:53:35  mselig
+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
 MSVC5 portability changes contributed by Bruce Finney.
@@ -149,6 +152,7 @@ static char rcsid[] = "$Id$";
 
 void cherokee_init( void );
 void c172_init( void );
+void basic_init( void );
 
 typedef struct
 {
@@ -245,6 +249,9 @@ void ls_init( char * aircraft ) {
     } else if (!strcasecmp(aircraft, "cherokee")) {
       printf("Initializing LaRCsim for Cherokee\n");
       current_model = CHEROKEE;
+    } else if (!strcasecmp(aircraft, "basic")) {
+      printf("Initializing LaRCsim for Basic\n");
+      current_model = BASIC;
     } else if (!strcasecmp(aircraft, "uiuc")) {
       printf("Initializing LaRCsim for UIUC models\n");
       current_model = UIUC;
@@ -283,6 +290,9 @@ void ls_init( char * aircraft ) {
     case CHEROKEE:
       cherokee_init();
       break;
+    case BASIC:
+      basic_init();
+      break;
     case UIUC:
       c172_init();
       break;
index 73590390766941ea497223f54d55527da968d34d..3f442ececa9c45fb9ebe6b84c9cbe605d215f0a0 100644 (file)
@@ -37,6 +37,9 @@
        CURRENT RCS HEADER INFO:
 $Header$
 $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
 Robert Deters:
 
@@ -168,6 +171,7 @@ void ls_model( SCALAR dt, int Initialize ) {
       navion_gear( dt, Initialize );
       break;
     case C172:
+      printf("here we are in C172 \n");
       if(Initialize < 0) c172_init();
       inertias( dt, Initialize );
       subsystems( dt, Initialize );
@@ -182,10 +186,22 @@ void ls_model( SCALAR dt, int Initialize ) {
       cherokee_engine( dt, Initialize );
       cherokee_gear( dt, Initialize );
       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:
       inertias( 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_engine_2_wrapper( dt, Initialize );
       uiuc_wind_2_wrapper( dt, Initialize );
index 9dfb636043cbff177ed440bf400202f04e70acc9..df980590f89a4e6a750aa97903c10a670a9b90d8 100644 (file)
@@ -8,6 +8,7 @@ typedef enum {
   NAVION,
   C172,
   CHEROKEE,
+  BASIC,
   UIUC
 } Model;
 
index 6268d23e74f7c395555c59f481da8fd904c306aa..3927425cd07df99c2296f0372c5c4751fd6f618c 100644 (file)
@@ -50,6 +50,9 @@
 
 $Header$
 $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
 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_constants.h"
@@ -361,11 +364,9 @@ void ls_step( SCALAR dt, int Initialize ) {
        V_east = V_east + local_gnd_veast;
 
 /* Initialize quaternions and transformation matrix from Euler angles */
-       if (current_model == UIUC && Simtime == 0) {
-         if (inited == 0) {
-           uiuc_defaults_inits();
-         }
-         uiuc_init_vars();
+       // Initialize UIUC aircraft model
+       if (current_model == UIUC) {
+         uiuc_init_2_wrapper();
         }
 
            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_33 = e_0*e_0 - e_1*e_1 - e_2*e_2 + e_3*e_3;
 
-       if (current_model == UIUC && Simtime == 0) {
-           uiuc_vel_init();
-        }
+           // Initialize local velocities (V_north, V_east, V_down)
+           // based on transformation matrix calculated above
+           if (current_model == UIUC) {
+             uiuc_local_vel_init();
+           }
 
 /*     Calculate local gravitation acceleration        */
 
index c218517d80d291b91f21533e1f120900f3b08dee..bd7d3358f39ee527a3662d2a488e8e0044dd5dd8 100644 (file)
@@ -66,11 +66,21 @@ void uiuc_init_2_wrapper()
 {
     static int init = 0;
 
-    if (init==0)
-    {
-      init = -1; 
-      uiuc_initial_init();
+    // On first time through initialize UIUC aircraft model
+    if (init==0) {
+        init=-1;
+       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 ) 
@@ -81,6 +91,7 @@ void uiuc_aero_2_wrapper( SCALAR dt, int Initialize )
 
 void uiuc_wind_2_wrapper( SCALAR dt, int Initialize ) 
 {
+  if (Initialize == 0)
     uiuc_wind_routine(dt);
 }
 
@@ -103,10 +114,10 @@ void uiuc_record_2_wrapper(SCALAR dt)
 
 void uiuc_network_recv_2_wrapper()
 {
-    uiuc_network_recv_routine();
+  uiuc_network_recv_routine();
 }
 
 void uiuc_network_send_2_wrapper()
 {
-    uiuc_network_send_routine();
+  uiuc_network_send_routine();
 }