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.
This commit is contained in:
parent
93c69c4bc3
commit
6c978b02f8
3 changed files with 22 additions and 5 deletions
|
@ -612,7 +612,12 @@ void FGJSBsim::set_Climb_Rate( double roc) {
|
||||||
SG_LOG(SG_FLIGHT,SG_INFO, "FGJSBsim::set_Climb_Rate: " << roc );
|
SG_LOG(SG_FLIGHT,SG_INFO, "FGJSBsim::set_Climb_Rate: " << roc );
|
||||||
|
|
||||||
update_ic();
|
update_ic();
|
||||||
|
//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);
|
fgic->SetClimbRateFpsIC(roc);
|
||||||
|
}
|
||||||
needTrim=true;
|
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 );
|
SG_LOG(SG_FLIGHT,SG_INFO, "FGJSBsim::set_Gamma_vert_rad: " << gamma );
|
||||||
|
|
||||||
update_ic();
|
update_ic();
|
||||||
|
if( !(fabs(gamma) < 0.01 && fabs(fgic->GetClimbRateFpsIC()) > 1) ) {
|
||||||
fgic->SetFlightPathAngleRadIC(gamma);
|
fgic->SetFlightPathAngleRadIC(gamma);
|
||||||
|
}
|
||||||
needTrim=true;
|
needTrim=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -351,7 +351,11 @@ FGInterface::bind ()
|
||||||
|
|
||||||
// Climb and slip (read-only)
|
// Climb and slip (read-only)
|
||||||
fgTie("/velocities/vertical-speed-fps", this,
|
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,
|
fgTie("/velocities/side-slip-rad", this,
|
||||||
&FGInterface::get_Beta); // read-only
|
&FGInterface::get_Beta); // read-only
|
||||||
fgTie("/velocities/side-slip-deg", this,
|
fgTie("/velocities/side-slip-deg", this,
|
||||||
|
@ -360,8 +364,6 @@ FGInterface::bind ()
|
||||||
&FGInterface::get_Alpha_deg); // read-only
|
&FGInterface::get_Alpha_deg); // read-only
|
||||||
fgTie("/accelerations/nlf", this,
|
fgTie("/accelerations/nlf", this,
|
||||||
&FGInterface::get_Nlf); // read-only
|
&FGInterface::get_Nlf); // read-only
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -395,6 +397,7 @@ FGInterface::unbind ()
|
||||||
fgUntie("/velocities/vBody-fps");
|
fgUntie("/velocities/vBody-fps");
|
||||||
fgUntie("/velocities/wBody-fps");
|
fgUntie("/velocities/wBody-fps");
|
||||||
fgUntie("/velocities/vertical-speed-fps");
|
fgUntie("/velocities/vertical-speed-fps");
|
||||||
|
fgUntie("/velocities/glideslope");
|
||||||
fgUntie("/velocities/side-slip-rad");
|
fgUntie("/velocities/side-slip-rad");
|
||||||
fgUntie("/velocities/side-slip-deg");
|
fgUntie("/velocities/side-slip-deg");
|
||||||
fgUntie("/velocities/alpha-deg");
|
fgUntie("/velocities/alpha-deg");
|
||||||
|
|
|
@ -666,6 +666,11 @@ parse_option (const string& arg)
|
||||||
fgSetDouble("/orientation/roll-deg", atof(arg.substr(7)));
|
fgSetDouble("/orientation/roll-deg", atof(arg.substr(7)));
|
||||||
} else if ( arg.find( "--pitch=" ) == 0 ) {
|
} else if ( arg.find( "--pitch=" ) == 0 ) {
|
||||||
fgSetDouble("/orientation/pitch-deg", atof(arg.substr(8)));
|
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 ) {
|
} else if ( arg.find( "--fg-root=" ) == 0 ) {
|
||||||
globals->set_fg_root(arg.substr( 10 ));
|
globals->set_fg_root(arg.substr( 10 ));
|
||||||
} else if ( arg.find( "--fg-scenery=" ) == 0 ) {
|
} else if ( arg.find( "--fg-scenery=" ) == 0 ) {
|
||||||
|
@ -1181,6 +1186,8 @@ fgUsage ()
|
||||||
<< " (in feet unless --units-meters specified)" << endl
|
<< " (in feet unless --units-meters specified)" << endl
|
||||||
<< " --vc=knots Specify initial airspeed" << endl
|
<< " --vc=knots Specify initial airspeed" << endl
|
||||||
<< " --mach=num Specify initial mach number" << 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
|
<< endl
|
||||||
|
|
||||||
<< "Rendering Options:" << endl
|
<< "Rendering Options:" << endl
|
||||||
|
|
Loading…
Reference in a new issue