]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim.cxx
From Tony Peden:
[flightgear.git] / src / FDM / JSBSim.cxx
index 993e11e56c7c60fb3d75383e30ea5820692d7a51..0714817c7e2f7abfdb52c01d1b876311fbef36d3 100644 (file)
@@ -55,8 +55,6 @@
 
 #include "JSBsim.hxx"
 
-double geocRwyRadius;
-
 /******************************************************************************/
 
 // Initialize the JSBsim flight model, dt is the time increment for
@@ -114,7 +112,7 @@ int FGJSBsim::init( double dt ) {
   fgic->SetLatitudeRadIC(get_Latitude());
   fgic->SetLongitudeRadIC(get_Longitude());
 
-  FDMExec.GetPosition()->SetRunwayRadius(geocRwyRadius);
+  FDMExec.GetPosition()->SetRunwayRadius(scenery.cur_radius);
 
   FG_LOG( FG_FLIGHT, FG_INFO, "  phi: " <<  get_Phi());
   FG_LOG( FG_FLIGHT, FG_INFO, "  theta: " <<  get_Theta() );
@@ -122,7 +120,8 @@ int FGJSBsim::init( double dt ) {
   FG_LOG( FG_FLIGHT, FG_INFO, "  lat: " <<  get_Latitude() );
   FG_LOG( FG_FLIGHT, FG_INFO, "  lon: " <<  get_Longitude() );
   FG_LOG( FG_FLIGHT, FG_INFO, "  alt: " <<  get_Altitude() );
-
+  
+  //must check > 0, != 0 will give bad result if --notrim set
   if(current_options.get_trim_mode() == true) {
     FG_LOG( FG_FLIGHT, FG_INFO, "  Starting trim..." );
     FGTrimLong *fgtrim=new FGTrimLong(&FDMExec,fgic);
@@ -130,14 +129,10 @@ int FGJSBsim::init( double dt ) {
     fgtrim->Report();
     fgtrim->TrimStats();
     fgtrim->ReportState();
+
+    controls.set_elevator_trim(FDMExec.GetFCS()->GetPitchTrimCmd());
+    controls.set_throttle(FGControls::ALL_ENGINES,FDMExec.GetFCS()->GetThrottleCmd(0)/100);
     
-    controls.set_elevator_trim(FDMExec.GetFCS()->GetDeCmd());
-    controls.set_trimmed_throttle(FGControls::ALL_ENGINES,FDMExec.GetFCS()->GetThrottleCmd(0)/100);
-    //the trimming routine only knows how to get 1 value for throttle
-    
-    //for(int i=0;i<FDMExec.GetAircraft()->GetNumEngines();i++) {
-    //  controls.set_throttle(i,FDMExec.GetFCS()->GetThrottleCmd(i)/100);
-    //}
     delete fgtrim;
     FG_LOG( FG_FLIGHT, FG_INFO, "  Trim complete." );
   } else {
@@ -189,8 +184,8 @@ int FGJSBsim::update( int multiloop ) {
   // FCS->SetBrake( controls.get_brake( 0 ) );
 
   // Inform JSBsim of the local terrain altitude; uncommented 5/3/00
-//  FDMExec.GetPosition()->SetRunwayElevation(get_Runway_altitude()); // seems to work
-  FDMExec.GetPosition()->SetRunwayRadius(geocRwyRadius);
+  //  FDMExec.GetPosition()->SetRunwayElevation(get_Runway_altitude()); // seems to work
+  FDMExec.GetPosition()->SetRunwayRadius(scenery.cur_radius);
 
   FDMExec.GetAtmosphere()->SetExTemperature(get_Static_temperature());
   FDMExec.GetAtmosphere()->SetExPressure(get_Static_pressure());