diff --git a/src/FDM/LaRCsim.cxx b/src/FDM/LaRCsim.cxx index be54fb096..07ebb0ea5 100644 --- a/src/FDM/LaRCsim.cxx +++ b/src/FDM/LaRCsim.cxx @@ -34,6 +34,7 @@ #include #include #include +#include #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 + 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; + //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; } diff --git a/src/FDM/LaRCsim/ls_model.c b/src/FDM/LaRCsim/ls_model.c index c717508c2..e2301d42e 100644 --- a/src/FDM/LaRCsim/ls_model.c +++ b/src/FDM/LaRCsim/ls_model.c @@ -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; } } diff --git a/src/FDM/LaRCsim/ls_step.c b/src/FDM/LaRCsim/ls_step.c index 053199ab2..71e90cc39 100644 --- a/src/FDM/LaRCsim/ls_step.c +++ b/src/FDM/LaRCsim/ls_step.c @@ -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 + #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 +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 ); diff --git a/src/FDM/LaRCsim/uiuc_aero.c b/src/FDM/LaRCsim/uiuc_aero.c index 24fa87480..e74537345 100644 --- a/src/FDM/LaRCsim/uiuc_aero.c +++ b/src/FDM/LaRCsim/uiuc_aero.c @@ -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); +} diff --git a/src/FDM/UIUCModel/uiuc_wrapper.cpp b/src/FDM/UIUCModel/uiuc_wrapper.cpp index 9984ef7d5..40fb04d68 100644 --- a/src/FDM/UIUCModel/uiuc_wrapper.cpp +++ b/src/FDM/UIUCModel/uiuc_wrapper.cpp @@ -90,7 +90,7 @@ #include "uiuc_menu.h" #include "uiuc_betaprobe.h" #include -#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 */