]> git.mxchange.org Git - flightgear.git/commitdiff
More changes in support of UIUCModel.
authorcurt <curt>
Fri, 14 Sep 2001 20:47:27 +0000 (20:47 +0000)
committercurt <curt>
Fri, 14 Sep 2001 20:47:27 +0000 (20:47 +0000)
src/FDM/LaRCsim.cxx
src/FDM/LaRCsim/ls_model.c
src/FDM/LaRCsim/ls_step.c
src/FDM/LaRCsim/uiuc_aero.c
src/FDM/UIUCModel/uiuc_wrapper.cpp

index be54fb09638b1f416b6b49b3d8ab6c152f33c88d..07ebb0ea55852328f0d8190a12eaee2feef1786a 100644 (file)
@@ -34,6 +34,7 @@
 #include <FDM/LaRCsim/ls_generic.h>
 #include <FDM/LaRCsim/ls_interface.h>
 #include <FDM/LaRCsimIC.hxx>
+#include <FDM/UIUCModel/uiuc_aircraft.h>
 
 #include "IO360.hxx"
 #include "LaRCsim.hxx"
@@ -47,14 +48,16 @@ FGLaRCsim::FGLaRCsim( double dt ) {
     ls_toplevel_init( 0.0, (char *)(aircraft->getStringValue().c_str()) );
 
     lsic=new LaRCsimIC; //this needs to be brought up after LaRCsim is
-    copy_to_LaRCsim(); // initialize all of LaRCsim's vars
-
-    //this should go away someday -- formerly done in fg_init.cxx
-    Mass = 8.547270E+01;
-    I_xx = 1.048000E+03;
-    I_yy = 3.000000E+03;
-    I_zz = 3.530000E+03;
-    I_xz = 0.000000E+00;
+    if ( aircraft->getStringValue() == "c172" ) {
+       copy_to_LaRCsim(); // initialize all of LaRCsim's vars
+
+       //this should go away someday -- formerly done in fg_init.cxx
+       Mass = 8.547270E+01;
+       I_xx = 1.048000E+03;
+       I_yy = 3.000000E+03;
+       I_zz = 3.530000E+03;
+       I_xz = 0.000000E+00;
+    }
     
     ls_set_model_dt( get_delta_t() );
     
@@ -537,6 +540,28 @@ bool FGLaRCsim::copy_from_LaRCsim() {
 
     _set_Climb_Rate( -1 * V_down );
     // cout << "climb rate = " << -V_down * 60 << endl;
+
+    if ( aircraft->getStringValue() == "uiuc" ) {
+       if (pilot_elev_no) {
+           globals->get_controls()->set_elevator(Long_control);
+           globals->get_controls()->set_elevator_trim(Long_trim);
+           //      controls.set_elevator(Long_control);
+           //      controls.set_elevator_trim(Long_trim);
+        }
+       if (pilot_ail_no) {
+            globals->get_controls()->set_aileron(Lat_control);
+            //   controls.set_aileron(Lat_control);
+        }
+       if (pilot_rud_no) {
+            globals->get_controls()->set_rudder(Rudder_pedal);
+            //   controls.set_rudder(Rudder_pedal);
+        }
+       if (Throttle_pct_input) {
+            globals->get_controls()->set_throttle(0,Throttle_pct);
+            //   controls.set_throttle(0,Throttle_pct);
+        }
+    }
+
     return true;
 }
 
index c717508c28ba999edf1f410e86cd5c1c10dbb87f..e2301d42ed6b449ef7bea83eb03679f57eb0d908 100644 (file)
@@ -37,6 +37,9 @@
        CURRENT RCS HEADER INFO:
 $Header$
 $Log$
+Revision 1.4  2001/09/14 18:47:27  curt
+More changes in support of UIUCModel.
+
 Revision 1.3  2000/10/28 14:30:33  curt
 Updates by Tony working on the FDM interface bus.
 
@@ -142,6 +145,7 @@ void ls_model( SCALAR dt, int Initialize ) {
       uiuc_aero( dt, Initialize );
       uiuc_engine( dt, Initialize );
       uiuc_gear( dt, Initialize );
+      uiuc_record(dt);
       break;
     }
 }
index 053199ab222c5d05d050fb29bdb25e71725b555e..71e90cc39890e82cad10fad8979eecb7c79d3e14 100644 (file)
@@ -50,6 +50,9 @@
 
 $Header$
 $Log$
+Revision 1.5  2001/09/14 18:47:27  curt
+More changes in support of UIUCModel.
+
 Revision 1.4  2001/03/24 05:03:12  curt
 SG-ified logstream.
 
@@ -278,6 +281,8 @@ Initial Flight Gear revision.
 
 --------------------------------------------------------------------------*/
 
+#include <FDM/UIUCModel/uiuc_wrapper.h>
+
 #include "ls_types.h"
 #include "ls_constants.h"
 #include "ls_generic.h"
@@ -290,8 +295,21 @@ Initial Flight Gear revision.
 /* #include "ls_sim_control.h" */
 #include <math.h>
 
+Model current_model;
 extern SCALAR Simtime;         /* defined in ls_main.c */
 
+void uiuc_init_vars() {
+    static int init = 0;
+
+    if (init==0) {
+        init=-1;
+        uiuc_init_aeromodel();
+    }
+
+    uiuc_initial_init();
+}
+
+
 void ls_step( SCALAR dt, int Initialize ) {
        static  int     inited = 0;
                SCALAR  dth;
@@ -330,6 +348,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) {
+           uiuc_init_vars();
+        }
 
            e_0 = cos(Psi*0.5)*cos(Theta*0.5)*cos(Phi*0.5) 
                + sin(Psi*0.5)*sin(Theta*0.5)*sin(Phi*0.5);
@@ -349,6 +370,10 @@ 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();
+        }
+
 /*     Calculate local gravitation acceleration        */
 
                ls_gravity( Radius_to_vehicle, Lat_geocentric, &Gravity );
index 24fa87480f1a5f1a4a519b14483487879ebc934d..e7453734535510125a5e9248c6850b067a0fa878 100644 (file)
@@ -29,7 +29,7 @@
   DATE         PURPOSE                                                                                         BY
   3/17/00   Initial test release  
   3/09/01   Added callout to UIUC gear function.   (DPM)
-  
+  6/18/01   Added call out to UIUC record routine (RD)
 
 ----------------------------------------------------------------------------
 
@@ -82,3 +82,8 @@ void uiuc_gear ()
 {
     uiuc_gear_routine();
 }
+
+void uiuc_record(SCALAR dt)
+{
+  uiuc_record_routine(dt);
+}
index 9984ef7d5e7d41f84bd6305ae5dcd4c11a0374f1..40fb04d68632f2ed12ada84ec87bfdfa70539fb3 100644 (file)
@@ -90,7 +90,7 @@
 #include "uiuc_menu.h"
 #include "uiuc_betaprobe.h"
 #include <FDM/LaRCsim/ls_generic.h>
-#include "Main/simple_udp.h"
+// #include "Main/simple_udp.h"
 #include "uiuc_fog.h" //321654
 
 #if !defined (SG_HAVE_NATIVE_SGI_COMPILERS)
@@ -109,7 +109,7 @@ extern "C" void uiuc_initial_init ();
 AIRCRAFT *aircraft_ = new AIRCRAFT;
 AIRCRAFTDIR *aircraftdir_ = new AIRCRAFTDIR;
 
-SendArray testarray(4950);
+// SendArray testarray(4950);
 
 /* Convert float to string */
 string ftoa(double in)
@@ -257,8 +257,8 @@ void uiuc_force_moment(double dt)
   input += " altitude " + ftoa(Altitude);
   input += " climb_rate " + ftoa(-1.0*V_down_rel_ground);
  
-  testarray.getHello();
-  testarray.sendData(input);
+  // testarray.getHello();
+  // testarray.sendData(input);
   
   /* End of Networking */