From 750b319de71ba7f92703b241e60d4c25626792f8 Mon Sep 17 00:00:00 2001 From: curt Date: Mon, 14 Dec 1998 13:31:06 +0000 Subject: [PATCH] LaRCsim maintains all it's variables internally. I had been copying all of them back and forth to the FG struture everytime I updated the flight model. However, I have realized that this is not necessary. I just need to copy the control positions and environmental parameters into the LaRCsim structure before updating the FDM, then copy every thing back out into the publick FGFS structure afterwords. This seems to solve (or at least help) a westward drift problem some poeple had been observing. --- FDM/LaRCsim.cxx | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/FDM/LaRCsim.cxx b/FDM/LaRCsim.cxx index 4c8f644cf..5e206dd24 100644 --- a/FDM/LaRCsim.cxx +++ b/FDM/LaRCsim.cxx @@ -51,8 +51,20 @@ int fgLaRCsimUpdate(FGState& f, int multiloop) { f.set_Altitude( 0.0 ); } + // copy control positions into the LaRCsim structure + Lat_control = controls.get_aileron(); + Long_control = controls.get_elevator(); + Long_trim = controls.get_elevator_trim(); + Rudder_pedal = controls.get_rudder(); + Throttle_pct = controls.get_throttle( 0 ); + Brake_pct = controls.get_brake( 0 ); + + // Inform LaRCsim of the local terrain altitude + Runway_altitude = f.get_Runway_altitude(); + + // old -- FGstate_2_LaRCsim() not needed except for Init() // translate FG to LaRCsim structure - FGState_2_LaRCsim(f); + // FGState_2_LaRCsim(f); // printf("FG_Altitude = %.2f\n", FG_Altitude * 0.3048); // printf("Altitude = %.2f\n", Altitude * 0.3048); // printf("Radius to Vehicle = %.2f\n", Radius_to_vehicle * 0.3048); @@ -79,13 +91,6 @@ int fgLaRCsimUpdate(FGState& f, int multiloop) { // Convert from the FGState struct to the LaRCsim generic_ struct int FGState_2_LaRCsim (FGState& f) { - Lat_control = controls.get_aileron(); - Long_control = controls.get_elevator(); - Long_trim = controls.get_elevator_trim(); - Rudder_pedal = controls.get_rudder(); - Throttle_pct = controls.get_throttle( 0 ); - Brake_pct = controls.get_brake( 0 ); - Mass = f.get_Mass(); I_xx = f.get_I_xx(); I_yy = f.get_I_yy(); @@ -382,6 +387,15 @@ int fgLaRCsim_2_FGState (FGState& f) { // $Log$ +// Revision 1.7 1998/12/14 13:31:06 curt +// LaRCsim maintains all it's variables internally. I had been copying all of +// them back and forth to the FG struture everytime I updated the flight model. +// However, I have realized that this is not necessary. I just need to copy +// the control positions and environmental parameters into the LaRCsim structure +// before updating the FDM, then copy every thing back out into the publick FGFS +// structure afterwords. This seems to solve (or at least help) a westward +// drift problem some poeple had been observing. +// // Revision 1.6 1998/12/05 15:54:08 curt // Renamed class fgFLIGHT to class FGState as per request by JSB. // -- 2.39.2