1
0
Fork 0

More changes in support of UIUCModel.

This commit is contained in:
curt 2001-09-14 20:47:27 +00:00
parent 19e7e93787
commit bfc56f9d17
5 changed files with 71 additions and 12 deletions

View 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,6 +48,7 @@ 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
if ( aircraft->getStringValue() == "c172" ) {
copy_to_LaRCsim(); // initialize all of LaRCsim's vars
//this should go away someday -- formerly done in fg_init.cxx
@ -55,6 +57,7 @@ FGLaRCsim::FGLaRCsim( double dt ) {
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;
}

View 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;
}
}

View 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 );

View 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);
}

View 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 */