X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FFDM%2FJSBSim.cxx;h=ed2794f393f41c16e232b92919f137332e6f2cdc;hb=f00b1f8b833301f57ed9b4152ebb431804cefdd5;hp=934645318a35fd3ae066269be40c21756d5af982;hpb=116e3913ae03adf55b3ae84dc750a5303e201a8b;p=flightgear.git diff --git a/src/FDM/JSBSim.cxx b/src/FDM/JSBSim.cxx index 934645318..ed2794f39 100644 --- a/src/FDM/JSBSim.cxx +++ b/src/FDM/JSBSim.cxx @@ -54,7 +54,7 @@ FGFDMExec FDMExec; // Initialize the JSBsim flight model, dt is the time increment for // each subsequent iteration through the EOM -int fgJSBsimInit(double dt) { +int fgJSBsimInit(double dt, FGInterface& f) { FG_LOG( FG_FLIGHT, FG_INFO, "Starting initializing JSBsim" ); FG_LOG( FG_FLIGHT, FG_INFO, " created FDMExec" ); @@ -69,7 +69,27 @@ int fgJSBsimInit(double dt) { engine_path.str(), "X15"); FG_LOG( FG_FLIGHT, FG_INFO, " loaded aircraft" ); - FDMExec.GetState()->Reset(aircraft_path.str(), "Reset00"); +// FDMExec.GetState()->Reset(aircraft_path.str(), "Reset00"); + + FDMExec.GetState()->Initialize( + current_options.get_uBody(), + current_options.get_vBody(), + current_options.get_wBody(), + f.get_Phi(), + f.get_Theta(), + f.get_Psi(), + f.get_Latitude(), + f.get_Longitude(), + f.get_Altitude() + ); + +// FDMExec.GetState()->Setlatitude(f.get_Latitude()); +// FDMExec.GetState()->Setlongitude(f.get_Longitude()); +// FDMExec.GetState()->Seth(f.get_Altitude()); +// FDMExec.GetRotation()->Setphi(f.get_Phi()); +// FDMExec.GetRotation()->Settht(f.get_Theta()); +// FDMExec.GetRotation()->Setpsi(f.get_Psi()); + FG_LOG( FG_FLIGHT, FG_INFO, " loaded initial conditions" ); FDMExec.GetState()->Setdt(dt); @@ -92,14 +112,14 @@ int fgJSBsimUpdate(FGInterface& f, int multiloop) { } // copy control positions into the JSBsim structure - FDMExec.GetFCS()->SetDa( controls.get_aileron() ); + FDMExec.GetFCS()->SetDa( controls.get_aileron()); FDMExec.GetFCS()->SetDe( controls.get_elevator() + controls.get_elevator_trim() ); - FDMExec.GetFCS()->SetDr( controls.get_rudder() ); + FDMExec.GetFCS()->SetDr( controls.get_rudder()); FDMExec.GetFCS()->SetDf( 0.0 ); FDMExec.GetFCS()->SetDs( 0.0 ); FDMExec.GetFCS()->SetThrottle( FGControls::ALL_ENGINES, - controls.get_throttle( 0 ) ); + controls.get_throttle( 0 ) * 100.0 ); // FCS->SetBrake( controls.get_brake( 0 ) ); // Inform JSBsim of the local terrain altitude