From 6c978b02f849436a512545b4cb4b22c18f212913 Mon Sep 17 00:00:00 2001 From: david Date: Mon, 18 Feb 2002 19:18:51 +0000 Subject: [PATCH] Patches from Tony Peden: 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 | 11 +++++++++-- src/FDM/flight.cxx | 9 ++++++--- src/Main/options.cxx | 7 +++++++ 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/FDM/JSBSim.cxx b/src/FDM/JSBSim.cxx index 926d9d34f..425109d46 100644 --- a/src/FDM/JSBSim.cxx +++ b/src/FDM/JSBSim.cxx @@ -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; } diff --git a/src/FDM/flight.cxx b/src/FDM/flight.cxx index 9bc133c08..6d404dd76 100644 --- a/src/FDM/flight.cxx +++ b/src/FDM/flight.cxx @@ -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"); diff --git a/src/Main/options.cxx b/src/Main/options.cxx index e85e8a386..e5949e0be 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -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 -- 2.39.5