X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FFDM%2FJSBSim.cxx;h=68997a3424f31b35727eae8bcbd45ab1fed87632;hb=407dcaff6236e7217eff16ac253218d3e51bce6d;hp=44058b127f05c4d7ec01a72896fd69a2f9dcc93f;hpb=11a68e55d4599b1e21c2e173acf7e1944e617161;p=flightgear.git diff --git a/src/FDM/JSBSim.cxx b/src/FDM/JSBSim.cxx index 44058b127..68997a342 100644 --- a/src/FDM/JSBSim.cxx +++ b/src/FDM/JSBSim.cxx @@ -117,7 +117,7 @@ bool FGJSBsim::init( double dt ) { #endif if (result) { - FG_LOG( FG_FLIGHT, FG_INFO, " loaded aircraft" << globals->get_options()->get_aircraft() ); + FG_LOG( FG_FLIGHT, FG_INFO, " loaded aircraft " << globals->get_options()->get_aircraft() ); } else { FG_LOG( FG_FLIGHT, FG_INFO, " aircraft " << globals->get_options()->get_aircraft() @@ -210,10 +210,14 @@ bool FGJSBsim::update( int multiloop ) { set_Altitude( 0.0 ); } - - - if(needTrim) { - FGTrim *fgtrim=new FGTrim(fdmex,fgic,tLongitudinal); + if(needTrim && (globals->get_options()->get_trim_mode() > 0)) { + FGTrim *fgtrim; + if(fgic->GetVcalibratedKtsIC() < 10 ) { + fgic->SetVcalibratedKtsIC(0.0); + fgtrim=new FGTrim(fdmex,fgic,tGround); + } else { + fgtrim=new FGTrim(fdmex,fgic,tLongitudinal); + } if(!fgtrim->DoTrim()) { fgtrim->Report(); fgtrim->TrimStats(); @@ -223,6 +227,7 @@ bool FGJSBsim::update( int multiloop ) { needTrim=false; + controls.set_elevator_trim(fdmex->GetFCS()->GetPitchTrimCmd()); controls.set_elevator(fdmex->GetFCS()->GetDeCmd()); controls.set_throttle(FGControls::ALL_ENGINES, @@ -250,6 +255,8 @@ bool FGJSBsim::update( int multiloop ) { // autopilot (and the rest of the sim can use the updated values copy_from_JSBsim(); + + // but lets restore our original bogus altitude when we are done @@ -380,12 +387,14 @@ bool FGJSBsim::copy_from_JSBsim() { _set_Alpha( fdmex->GetTranslation()->Getalpha() ); _set_Beta( fdmex->GetTranslation()->Getbeta() ); + _set_Gamma_vert_rad( fdmex->GetPosition()->GetGamma() ); // set_Gamma_horiz_rad( Gamma_horiz_rad ); _set_Earth_position_angle( fdmex->GetAuxiliary()->GetEarthPositionAngle() ); _set_Climb_Rate( fdmex->GetPosition()->Gethdot() ); + for ( i = 1; i <= 3; i++ ) { for ( j = 1; j <= 3; j++ ) {