]> git.mxchange.org Git - flightgear.git/commitdiff
Patches from Tony Peden:
authordavid <david>
Mon, 18 Feb 2002 19:18:51 +0000 (19:18 +0000)
committerdavid <david>
Mon, 18 Feb 2002 19:18:51 +0000 (19:18 +0000)
Attached are patches for adding the command line options to set initial
glideslope and climb rate. This was really easy to do as all the pieces
were in place.  It works well with JSBSim because the trimming routine
finds the right throttle and elevator settings. It should work with
LaRCsim as well, but it has no trimming routine so there will be some
dynamics at startup.  I don't know what YASim will do.

src/FDM/JSBSim.cxx
src/FDM/flight.cxx
src/Main/options.cxx

index 926d9d34fef70ccbbb5d85802a24cd48bb7cce00..425109d46b1da773ab5664ed715a9e0e9481cddc 100644 (file)
@@ -612,7 +612,12 @@ void FGJSBsim::set_Climb_Rate( double roc) {
     SG_LOG(SG_FLIGHT,SG_INFO, "FGJSBsim::set_Climb_Rate: " << roc );
     
     update_ic();
-    fgic->SetClimbRateFpsIC(roc);
+    //since both climb rate and flight path angle are set in the FG
+    //startup sequence, something is needed to keep one from cancelling
+    //out the other.
+    if( !(fabs(roc) > 1 && fabs(fgic->GetFlightPathAngleRadIC()) < 0.01) ) {
+      fgic->SetClimbRateFpsIC(roc);
+    }  
     needTrim=true;
 }
 
@@ -620,7 +625,9 @@ void FGJSBsim::set_Gamma_vert_rad( double gamma) {
     SG_LOG(SG_FLIGHT,SG_INFO, "FGJSBsim::set_Gamma_vert_rad: " << gamma );
     
     update_ic();
-    fgic->SetFlightPathAngleRadIC(gamma);
+    if( !(fabs(gamma) < 0.01 && fabs(fgic->GetClimbRateFpsIC()) > 1) ) {
+      fgic->SetFlightPathAngleRadIC(gamma);
+    }  
     needTrim=true;
 }
 
index 9bc133c08dba5b344b6832d9920dbb18af3ff8c2..6d404dd76676717a91580d529bd93636735a6c31 100644 (file)
@@ -351,7 +351,11 @@ FGInterface::bind ()
 
                                // Climb and slip (read-only)
   fgTie("/velocities/vertical-speed-fps", this,
-       &FGInterface::get_Climb_Rate); // read-only
+       &FGInterface::get_Climb_Rate,
+  &FGInterface::set_Climb_Rate ); 
+  fgTie("/velocities/glideslope", this,
+  &FGInterface::get_Gamma_vert_rad,
+  &FGInterface::set_Gamma_vert_rad );
   fgTie("/velocities/side-slip-rad", this,
        &FGInterface::get_Beta); // read-only
   fgTie("/velocities/side-slip-deg", this,
@@ -360,8 +364,6 @@ FGInterface::bind ()
   &FGInterface::get_Alpha_deg); // read-only
   fgTie("/accelerations/nlf", this,
   &FGInterface::get_Nlf); // read-only
-  
-  
 }
 
 
@@ -395,6 +397,7 @@ FGInterface::unbind ()
   fgUntie("/velocities/vBody-fps");
   fgUntie("/velocities/wBody-fps");
   fgUntie("/velocities/vertical-speed-fps");
+  fgUntie("/velocities/glideslope");
   fgUntie("/velocities/side-slip-rad");
   fgUntie("/velocities/side-slip-deg");
   fgUntie("/velocities/alpha-deg");
index e85e8a3864ce53809980038f2d1fb0e75cb77d44..e5949e0be57a794384166e361d57670eb993150c 100644 (file)
@@ -666,6 +666,11 @@ parse_option (const string& arg)
        fgSetDouble("/orientation/roll-deg", atof(arg.substr(7)));
     } else if ( arg.find( "--pitch=" ) == 0 ) {
        fgSetDouble("/orientation/pitch-deg", atof(arg.substr(8)));
+    } else if ( arg.find( "--glideslope=" ) == 0 ) {
+       fgSetDouble("/velocities/glideslope", atof(arg.substr(13))
+                                          *SG_DEGREES_TO_RADIANS);
+    }  else if ( arg.find( "--roc=" ) == 0 ) {
+       fgSetDouble("/velocities/vertical-speed-fps", atof(arg.substr(6))/60);
     } else if ( arg.find( "--fg-root=" ) == 0 ) {
        globals->set_fg_root(arg.substr( 10 ));
     } else if ( arg.find( "--fg-scenery=" ) == 0 ) {
@@ -1181,6 +1186,8 @@ fgUsage ()
          << "                                  (in feet unless --units-meters specified)" << endl
          << "    --vc=knots                    Specify initial airspeed" << endl
          << "    --mach=num                    Specify initial mach number" << endl
+         << "    --glideslope=degreees         Specify flight path angle (can be positive)" << endl
+         << "    --roc=fpm                     Specify initial climb rate (can be negative)" << endl
          << endl
 
          << "Rendering Options:" << endl