From: curt Date: Mon, 9 Oct 2000 21:16:21 +0000 (+0000) Subject: Oct. 9, 2000 - synced with latest JSBsim code. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b85ea575a323ff0d132fd8037bf4352ea6636a51;p=flightgear.git Oct. 9, 2000 - synced with latest JSBsim code. --- diff --git a/src/FDM/JSBSim.cxx b/src/FDM/JSBSim.cxx index 6c1794c95..192a5a080 100644 --- a/src/FDM/JSBSim.cxx +++ b/src/FDM/JSBSim.cxx @@ -50,6 +50,7 @@ #include #include #include +#include #include #include "JSBSim.hxx" @@ -92,13 +93,17 @@ int FGJSBsim::init( double dt ) { FDMExec.GetAtmosphere()->SetWindNED(get_V_north_airmass(), get_V_east_airmass(), get_V_down_airmass()); - + FDMExec.GetAtmosphere()->UseInternal(); + + + FDMExec.GetPosition()->SetRunwayRadius(scenery.cur_radius*METER_TO_FEET); + FDMExec.GetPosition()->SetSeaLevelRadius(get_Sea_level_radius()); FG_LOG( FG_FLIGHT, FG_INFO, " Initializing JSBSim with:" ); - + FGInitialCondition *fgic = new FGInitialCondition(&FDMExec); - fgic->SetAltitudeFtIC(get_Altitude()); + fgic->SetAltitudeAGLFtIC(get_Altitude()); if((current_options.get_mach() < 0) && (current_options.get_vc() < 0 )) { fgic->SetUBodyFpsIC(current_options.get_uBody()); fgic->SetVBodyFpsIC(current_options.get_vBody()); @@ -116,36 +121,42 @@ int FGJSBsim::init( double dt ) { //current_options.get_vc() will return zero by default } - + //fgic->SetFlightPathAngleDegIC(current_options.get_Gamma()); fgic->SetRollAngleRadIC(get_Phi()); fgic->SetPitchAngleRadIC(get_Theta()); fgic->SetHeadingRadIC(get_Psi()); -// fgic->SetLatitudeRadIC(get_Latitude()); fgic->SetLatitudeRadIC(get_Lat_geocentric()); fgic->SetLongitudeRadIC(get_Longitude()); - FDMExec.GetPosition()->SetRunwayRadius(scenery.cur_radius*METER_TO_FEET); - FDMExec.GetPosition()->SetSeaLevelRadius(get_Sea_level_radius()); - FDMExec.GetPosition()->SetRunwayNormal( scenery.cur_normal[0], - scenery.cur_normal[1], - scenery.cur_normal[2] ); - + + + + //FG_LOG( FG_FLIGHT, FG_INFO, " gamma: " << current_options.get_Gamma()); FG_LOG( FG_FLIGHT, FG_INFO, " phi: " << get_Phi()); - FG_LOG( FG_FLIGHT, FG_INFO, " theta: " << get_Theta() ); + //FG_LOG( FG_FLIGHT, FG_INFO, " theta: " << get_Theta() ); FG_LOG( FG_FLIGHT, FG_INFO, " psi: " << get_Psi() ); FG_LOG( FG_FLIGHT, FG_INFO, " lat: " << get_Latitude() ); FG_LOG( FG_FLIGHT, FG_INFO, " lon: " << get_Longitude() ); - FG_LOG( FG_FLIGHT, FG_INFO, " alt: " << get_Altitude() ); - + + FG_LOG( FG_FLIGHT, FG_INFO, " Pressure Altiude: " << get_Altitude() ); + FG_LOG( FG_FLIGHT, FG_INFO, " Terrain Altitude: " + << scenery.cur_radius*METER_TO_FEET ); + FG_LOG( FG_FLIGHT, FG_INFO, " AGL Altitude: " + << get_Altitude() + get_Sea_level_radius() + - scenery.cur_radius*METER_TO_FEET ); + + FG_LOG( FG_FLIGHT, FG_INFO, " current_options.get_altitude(): " + << current_options.get_altitude() ); //must check > 0, != 0 will give bad result if --notrim set if(current_options.get_trim_mode() > 0) { FDMExec.RunIC(fgic); FG_LOG( FG_FLIGHT, FG_INFO, " Starting trim..." ); -// FGTrimLong *fgtrim=new FGTrimLong(&FDMExec,fgic); -// fgtrim->DoTrim(); -// fgtrim->Report(); -// fgtrim->TrimStats(); -// fgtrim->ReportState(); + FGTrim *fgtrim=new FGTrim(&FDMExec,fgic,tLongitudinal); + fgtrim->DoTrim(); + fgtrim->Report(); + fgtrim->TrimStats(); + fgtrim->ReportState(); + controls.set_elevator_trim(FDMExec.GetFCS()->GetPitchTrimCmd()); controls.set_throttle(FGControls::ALL_ENGINES,FDMExec.GetFCS()->GetThrottleCmd(0)/100); @@ -180,41 +191,15 @@ int FGJSBsim::update( int multiloop ) { double save_alt = 0.0; double time_step = (1.0 / current_options.get_model_hz()) * multiloop; double start_elev = get_Altitude(); - + + // lets try to avoid really screwing up the JSBsim model if ( get_Altitude() < -9000 ) { save_alt = get_Altitude(); set_Altitude( 0.0 ); } - // copy control positions into the JSBsim structure - - FDMExec.GetFCS()->SetDaCmd( controls.get_aileron()); - FDMExec.GetFCS()->SetDeCmd( controls.get_elevator()); - FDMExec.GetFCS()->SetPitchTrimCmd(controls.get_elevator_trim()); - FDMExec.GetFCS()->SetDrCmd( controls.get_rudder()); - FDMExec.GetFCS()->SetDfCmd( controls.get_flaps() ); - FDMExec.GetFCS()->SetDsbCmd( 0.0 ); //speedbrakes - FDMExec.GetFCS()->SetDspCmd( 0.0 ); //spoilers - FDMExec.GetFCS()->SetThrottleCmd( FGControls::ALL_ENGINES, - controls.get_throttle( 0 ) * 100.0 ); - - // FCS->SetBrake( controls.get_brake( 0 ) ); - - // Inform JSBsim of the local terrain altitude; uncommented 5/3/00 - // FDMExec.GetPosition()->SetRunwayElevation(get_Runway_altitude()); // seems to work - FDMExec.GetPosition()->SetRunwayRadius(scenery.cur_radius*METER_TO_FEET); - FDMExec.GetPosition()->SetSeaLevelRadius(get_Sea_level_radius()); - FDMExec.GetPosition()->SetRunwayNormal( scenery.cur_normal[0], - scenery.cur_normal[1], - scenery.cur_normal[2] ); - - FDMExec.GetAtmosphere()->SetExTemperature(get_Static_temperature()); - FDMExec.GetAtmosphere()->SetExPressure(get_Static_pressure()); - FDMExec.GetAtmosphere()->SetExDensity(get_Density()); - FDMExec.GetAtmosphere()->SetWindNED(get_V_north_airmass(), - get_V_east_airmass(), - get_V_down_airmass()); + copy_to_JSBsim(); for ( int i = 0; i < multiloop; i++ ) { FDMExec.Run(); @@ -235,10 +220,6 @@ int FGJSBsim::update( int multiloop ) { } double end_elev = get_Altitude(); - //if ( time_step > 0.0 ) { - // feet per second - // set_Climb_Rate( (end_elev - start_elev) / time_step ); - //} return 1; } @@ -248,6 +229,34 @@ int FGJSBsim::update( int multiloop ) { // Convert from the FGInterface struct to the JSBsim generic_ struct int FGJSBsim::copy_to_JSBsim() { + // copy control positions into the JSBsim structure + + FDMExec.GetFCS()->SetDaCmd( controls.get_aileron()); + FDMExec.GetFCS()->SetDeCmd( controls.get_elevator()); + FDMExec.GetFCS()->SetPitchTrimCmd(controls.get_elevator_trim()); + FDMExec.GetFCS()->SetDrCmd( controls.get_rudder()); + FDMExec.GetFCS()->SetDfCmd( controls.get_flaps() ); + FDMExec.GetFCS()->SetDsbCmd( 0.0 ); //speedbrakes + FDMExec.GetFCS()->SetDspCmd( 0.0 ); //spoilers + FDMExec.GetFCS()->SetThrottleCmd( FGControls::ALL_ENGINES, + controls.get_throttle( 0 ) * 100.0 ); + + FDMExec.GetFCS()->SetLBrake( controls.get_brake( 0 ) ); + FDMExec.GetFCS()->SetRBrake( controls.get_brake( 1 ) ); + FDMExec.GetFCS()->SetCBrake( controls.get_brake( 2 ) ); + + // Inform JSBsim of the local terrain altitude; uncommented 5/3/00 + // FDMExec.GetPosition()->SetRunwayElevation(get_Runway_altitude()); // seems to work + FDMExec.GetPosition()->SetRunwayRadius(scenery.cur_radius*METER_TO_FEET); + FDMExec.GetPosition()->SetSeaLevelRadius(get_Sea_level_radius()); + + FDMExec.GetAtmosphere()->SetExTemperature(get_Static_temperature()); + FDMExec.GetAtmosphere()->SetExPressure(get_Static_pressure()); + FDMExec.GetAtmosphere()->SetExDensity(get_Density()); + FDMExec.GetAtmosphere()->SetWindNED(get_V_north_airmass(), + get_V_east_airmass(), + get_V_down_airmass()); + return 1; } @@ -315,9 +324,9 @@ int FGJSBsim::copy_from_JSBsim() { FDMExec.GetState()->GetParameter(FG_PITCHRATE), FDMExec.GetState()->GetParameter(FG_YAWRATE) ); - /* HUH!?! */ set_Euler_Rates( FDMExec.GetRotation()->Getphi(), - FDMExec.GetRotation()->Gettht(), - FDMExec.GetRotation()->Getpsi() ); + set_Euler_Rates( FDMExec.GetRotation()->GetEulerRates()(2), + FDMExec.GetRotation()->GetEulerRates()(1), + FDMExec.GetRotation()->GetEulerRates()(3)); // ***FIXME*** set_Geocentric_Rates( Latitude_dot, Longitude_dot, Radius_dot ); diff --git a/src/FDM/JSBSim/FGAircraft.cpp b/src/FDM/JSBSim/FGAircraft.cpp index be6586871..74859c38d 100644 --- a/src/FDM/JSBSim/FGAircraft.cpp +++ b/src/FDM/JSBSim/FGAircraft.cpp @@ -167,29 +167,34 @@ FGAircraft::FGAircraft(FGFDMExec* fdmex) : FGModel(fdmex), FGAircraft::~FGAircraft(void) { unsigned int i,j; + cout << " ~FGAircraft" << endl; - if(Engine != NULL) { - for(i=0;iForce(); +// vMoments += iGear->Moment(); +// iGear++; +// } + for (unsigned int i=0;iForce(); vMoments += lGear[i]->Moment(); diff --git a/src/FDM/JSBSim/FGAircraft.h b/src/FDM/JSBSim/FGAircraft.h index df74d0fe9..9c2b287cd 100644 --- a/src/FDM/JSBSim/FGAircraft.h +++ b/src/FDM/JSBSim/FGAircraft.h @@ -100,13 +100,16 @@ INCLUDES # include # ifdef FG_HAVE_STD_INCLUDES # include +# include # include # else # include +# include # include # endif #else # include +# include # include #endif @@ -174,6 +177,8 @@ public: string GetGroundReactionStrings(void); string GetGroundReactionValues(void); + vector ::iterator iGear; + enum { ssSimulation = 1, ssAerosurfaces = 2, ssRates = 4, @@ -231,6 +236,7 @@ private: string Axis[6]; vector lGear; + string AircraftPath; string EnginePath; void ReadMetrics(FGConfigFile*); diff --git a/src/FDM/JSBSim/FGControls.cpp b/src/FDM/JSBSim/FGControls.cpp index 9fdc03b90..4e5935586 100644 --- a/src/FDM/JSBSim/FGControls.cpp +++ b/src/FDM/JSBSim/FGControls.cpp @@ -51,8 +51,8 @@ FGControls::~FGControls() { // $Log$ -// Revision 1.15 2000/10/02 21:07:31 curt -// Oct 2, 2000 JSBSim sync. +// Revision 1.16 2000/10/09 19:16:22 curt +// Oct. 9, 2000 - synced with latest JSBsim code. // // Revision 1.3 2000/04/26 10:55:57 jsb // Made changes as required by Curt to install JSBSim into FGFS diff --git a/src/FDM/JSBSim/FGControls.h b/src/FDM/JSBSim/FGControls.h index d1b15ca29..0b94d242d 100644 --- a/src/FDM/JSBSim/FGControls.h +++ b/src/FDM/JSBSim/FGControls.h @@ -177,8 +177,8 @@ extern FGControls controls; // $Log$ -// Revision 1.14 2000/10/02 21:07:31 curt -// Oct 2, 2000 JSBSim sync. +// Revision 1.15 2000/10/09 19:16:22 curt +// Oct. 9, 2000 - synced with latest JSBsim code. // // Revision 1.6 2000/06/03 13:59:52 jsb // Changes for compatibility with MSVC diff --git a/src/FDM/JSBSim/FGDefs.h b/src/FDM/JSBSim/FGDefs.h index d5db29429..56ca313bf 100644 --- a/src/FDM/JSBSim/FGDefs.h +++ b/src/FDM/JSBSim/FGDefs.h @@ -55,13 +55,13 @@ SENTRY #define FPSTOKTS 0.592484 #define INCHTOFT 0.08333333 #define OMEGA_EARTH .00007272205217 -#define NEEDED_CFG_VERSION "1.30" +#define NEEDED_CFG_VERSION "1.35" #define HPTOFTLBSSEC 550 #define METERS_TO_FEET 3.2808 enum eParam { - FG_NOTHING = 0, + FG_UNDEF = 0, FG_QBAR, FG_WINGAREA, FG_WINGSPAN, diff --git a/src/FDM/JSBSim/FGFCS.cpp b/src/FDM/JSBSim/FGFCS.cpp index ed149ddeb..a29df963b 100644 --- a/src/FDM/JSBSim/FGFCS.cpp +++ b/src/FDM/JSBSim/FGFCS.cpp @@ -63,7 +63,7 @@ INCLUDES FGFCS::FGFCS(FGFDMExec* fdmex) : FGModel(fdmex) { Name = "FGFCS"; - for (int i=0; i < MAX_ENGINES; i++) { + for (int i=0; i < MAX_ENGINES; i++) { // needs to be changed: no limit ThrottleCmd[i] = 0.0; ThrottlePos[i] = 0.0; } @@ -115,6 +115,20 @@ void FGFCS::SetThrottlePos(int engineNum, float setting) { /******************************************************************************/ +void FGFCS::SetLBrake(float setting) { + +} + +/******************************************************************************/ + +void FGFCS::SetRBrake(float setting) { +} + +/******************************************************************************/ +void FGFCS::SetCBrake(float setting) { +} + +/******************************************************************************/ bool FGFCS::LoadFCS(FGConfigFile* AC_cfg) { string token; diff --git a/src/FDM/JSBSim/FGFCS.h b/src/FDM/JSBSim/FGFCS.h index 235276e6d..7cf37bf16 100644 --- a/src/FDM/JSBSim/FGFCS.h +++ b/src/FDM/JSBSim/FGFCS.h @@ -64,8 +64,8 @@ private: float DaCmd, DeCmd, DrCmd, DfCmd, DsbCmd, DspCmd; float DaPos, DePos, DrPos, DfPos, DsbPos, DspPos; float PTrimCmd; - float ThrottleCmd[MAX_ENGINES]; - float ThrottlePos[MAX_ENGINES]; + float ThrottleCmd[MAX_ENGINES]; // Needs to be changed: no limit + float ThrottlePos[MAX_ENGINES]; // Needs to be changed: no limit vector Components; @@ -113,6 +113,9 @@ public: inline void SetDsbPos(float tt) { DsbPos = tt; } inline void SetDspPos(float tt) { DspPos = tt; } + void SetLBrake(float); + void SetRBrake(float); + void SetCBrake(float); void SetThrottlePos(int ii, float tt); diff --git a/src/FDM/JSBSim/FGFDMExec.cpp b/src/FDM/JSBSim/FGFDMExec.cpp index a46a9644a..e24b445a4 100644 --- a/src/FDM/JSBSim/FGFDMExec.cpp +++ b/src/FDM/JSBSim/FGFDMExec.cpp @@ -128,25 +128,15 @@ FGFDMExec::FGFDMExec(void) FGFDMExec::~FGFDMExec(void){ - cout << "~FGFDMExec" << endl; if ( Atmosphere != NULL ) delete Atmosphere; - cout << "Atmosphere" << endl; if ( FCS != NULL ) delete FCS; - cout << "FCS" << endl; if ( Aircraft != NULL ) delete Aircraft; - cout << "Aircraft" << endl; if ( Translation != NULL ) delete Translation; - cout << "Translation" << endl; if ( Rotation != NULL ) delete Rotation; - cout << "Rotation" << endl; if ( Position != NULL ) delete Position; - cout << "Position" << endl; if ( Auxiliary != NULL ) delete Auxiliary; - cout << "Auxiliary" << endl; if ( Output != NULL ) delete Output; - cout << "Output" << endl; if ( State != NULL ) delete State; - cout << "State" << endl; } diff --git a/src/FDM/JSBSim/FGInertial.h b/src/FDM/JSBSim/FGInertial.h index f3f6c3680..f0706a46c 100644 --- a/src/FDM/JSBSim/FGInertial.h +++ b/src/FDM/JSBSim/FGInertial.h @@ -54,6 +54,7 @@ INCLUDES #endif #include "FGModel.h" +#include "FGConfigFile.h" /******************************************************************************* CLASS DECLARATION diff --git a/src/FDM/JSBSim/FGInitialCondition.cpp b/src/FDM/JSBSim/FGInitialCondition.cpp index 521a366d7..53edce96d 100644 --- a/src/FDM/JSBSim/FGInitialCondition.cpp +++ b/src/FDM/JSBSim/FGInitialCondition.cpp @@ -62,14 +62,15 @@ FGInitialCondition::FGInitialCondition(FGFDMExec *FDMExec) { theta=phi=psi=0; altitude=hdot=0; latitude=longitude=0; - u=v=w=0; + u=v=w=0; + vnorth=veast=vdown=0; lastSpeedSet=setvt; if(FDMExec != NULL ) { fdmex=FDMExec; fdmex->GetPosition()->Seth(altitude); fdmex->GetAtmosphere()->Run(); } else { - cout << "FGInitialCondition: This class requires a pointer to an valid FGFDMExec object" << endl; + cout << "FGInitialCondition: This class requires a pointer to a valid FGFDMExec object" << endl; } } @@ -119,12 +120,14 @@ void FGInitialCondition::SetMachIC(float tt) { //cout << "Vt: " << vt*FPSTOKTS << " Vc: " << vc*FPSTOKTS << endl; } - - void FGInitialCondition::SetClimbRateFpmIC(float tt) { + SetClimbRateFpsIC(tt/60.0); +} + +void FGInitialCondition::SetClimbRateFpsIC(float tt) { if(vt > 0.1) { - hdot=tt/60; + hdot=tt; gamma=asin(hdot/vt); } } @@ -143,7 +146,6 @@ void FGInitialCondition::SetUBodyFpsIC(float tt) { } - void FGInitialCondition::SetVBodyFpsIC(float tt) { v=tt; vt=sqrt(u*u+v*v+w*w); @@ -184,7 +186,41 @@ void FGInitialCondition::SetAltitudeAGLFtIC(float tt) { fdmex->GetPosition()->SetDistanceAGL(tt); altitude=fdmex->GetPosition()->Geth(); SetAltitudeFtIC(altitude); -} +} + +void FGInitialCondition::calcUVWfromNED(void) { + u=vnorth*cos(theta)*cos(psi) + + veast*cos(theta)*sin(psi) - + vdown*sin(theta); + v=vnorth*(sin(phi)*sin(theta)*cos(psi) - cos(phi)*sin(psi)) + + veast*(sin(phi)*sin(theta)*sin(psi) + cos(phi)*cos(psi)) + + vdown*sin(phi)*cos(theta); + w=vnorth*(cos(phi)*sin(theta)*cos(psi) + sin(phi)*sin(psi)) + + veast*(cos(phi)*sin(theta)*sin(psi) - sin(phi)*cos(psi)) + + vdown*cos(phi)*cos(theta); +} + +void FGInitialCondition::SetVnorthFpsIC(float tt) { + vnorth=tt; + calcUVWfromNED(); + vt=sqrt(u*u + v*v + w*w); + lastSpeedSet=setvt; +} + +void FGInitialCondition::SetVeastFpsIC(float tt) { + veast=tt; + calcUVWfromNED(); + vt=sqrt(u*u + v*v + w*w); + lastSpeedSet=setvt; +} + +void FGInitialCondition::SetVdownFpsIC(float tt) { + vdown=tt; + calcUVWfromNED(); + vt=sqrt(u*u + v*v + w*w); + SetClimbRateFpsIC(-1*vdown); + lastSpeedSet=setvt; +} bool FGInitialCondition::getMachFromVcas(float *Mach,float vcas) { diff --git a/src/FDM/JSBSim/FGInitialCondition.h b/src/FDM/JSBSim/FGInitialCondition.h index 86635749f..bd8d48a10 100644 --- a/src/FDM/JSBSim/FGInitialCondition.h +++ b/src/FDM/JSBSim/FGInitialCondition.h @@ -89,12 +89,10 @@ typedef enum { setvt, setvc, setve, setmach } speedset; Alpha,Gamma, and Theta: This class assumes that it will be used to set up the sim for a - steady, zero pitch rate condition. This entails the assumption - that alpha=theta-gamma. Since any two of those angles specifies - the third (again, for zero pitch rate) gamma (flight path angle) - is favored when setting alpha and theta and alpha is favored when - setting gamma. i.e. - set alpha : recalculate theta using gamma as currently set + steady, zero pitch rate condition. Since any two of those angles + specifies the third gamma (flight path angle) is favored when setting + alpha and theta and alpha is favored when setting gamma. i.e. + set alpha : recalculate theta using gamma as currently set set theta : recalculate alpha using gamma as currently set set gamma : recalculate theta using alpha as currently set @@ -119,7 +117,11 @@ public: void SetUBodyFpsIC(float tt); void SetVBodyFpsIC(float tt); void SetWBodyFpsIC(float tt); - + + void SetVnorthFpsIC(float tt); + void SetVeastFpsIC(float tt); + void SetVdownFpsIC(float tt); + void SetAltitudeFtIC(float tt); void SetAltitudeAGLFtIC(float tt); @@ -128,6 +130,7 @@ public: void SetFlightPathAngleRadIC(float tt); //set speed first void SetClimbRateFpmIC(float tt); + void SetClimbRateFpsIC(float tt); //use currently stored gamma, recalcualte theta inline void SetAlphaDegIC(float tt) { alpha=tt*DEGTORAD; getTheta(); } inline void SetAlphaRadIC(float tt) { alpha=tt; getTheta(); } @@ -203,6 +206,7 @@ private: float altitude,hdot; float latitude,longitude; float u,v,w; + float vnorth,veast,vdown; float xlo, xhi,xmin,xmax; @@ -221,6 +225,7 @@ private: float GammaEqOfTheta(float Theta); float GammaEqOfAlpha(float Alpha); float calcVcas(float Mach); + void calcUVWfromNED(void); bool findInterval(float x,float guess); bool solve(float *y, float x); diff --git a/src/FDM/JSBSim/FGLGear.cpp b/src/FDM/JSBSim/FGLGear.cpp index 3acf3ad43..322412fd0 100644 --- a/src/FDM/JSBSim/FGLGear.cpp +++ b/src/FDM/JSBSim/FGLGear.cpp @@ -51,22 +51,25 @@ FGLGear::FGLGear(FGConfigFile* AC_cfg, FGFDMExec* fdmex) : vXYZ(3), { string tmp; *AC_cfg >> tmp >> name >> vXYZ(1) >> vXYZ(2) >> vXYZ(3) - >> kSpring >> bDamp >> statFCoeff >> brakeCoeff; - - + >> kSpring >> bDamp>> dynamicFCoeff >> staticFCoeff + >> SteerType >> BrakeType >> GroupMember >> maxSteerAngle; + cout << " Name: " << name << endl; cout << " Location: " << vXYZ << endl; - cout << " Spring Constant: " << kSpring << endl; + cout << " Spring Constant: " << kSpring << endl; cout << " Damping Constant: " << bDamp << endl; - cout << " Rolling Resistance: " << statFCoeff << endl; - cout << " Braking Coeff: " << brakeCoeff << endl; + cout << " Dynamic Friction: " << dynamicFCoeff << endl; + cout << " Static Friction: " << staticFCoeff << endl; + cout << " Brake Type: " << BrakeType << endl; + cout << " Grouping: " << GroupMember << endl; + cout << " Steering Type: " << SteerType << endl; + cout << " Max Steer Angle: " << maxSteerAngle << endl; State = Exec->GetState(); Aircraft = Exec->GetAircraft(); Position = Exec->GetPosition(); Rotation = Exec->GetRotation(); - WOW = false; ReportEnable=true; FirstContact = false; @@ -113,12 +116,20 @@ FGColumnVector FGLGear::Force(void) GroundSpeed = Position->GetVel().Magnitude(); } + // The following code normalizes the wheel velocity vector, reverses it, and zeroes out + // the z component of the velocity. The question is, should the Z axis velocity be zeroed + // out first before the normalization takes place or not? Subsequent to that, the Wheel + // Velocity vector now points as a unit vector backwards and parallel to the wheel + // velocity vector. It acts AT the wheel. + vWhlVelVec = -1.0 * vWhlVelVec.Normalize(); vWhlVelVec(eZ) = 0.00; +// the following needs work regarding friction coefficients and braking and steering + vLocalForce(eZ) = min(-compressLength * kSpring - compressSpeed * bDamp, (float)0.0); - vLocalForce(eX) = fabs(vLocalForce(eZ) * statFCoeff) * vWhlVelVec(eX); - vLocalForce(eY) = fabs(vLocalForce(eZ) * statFCoeff) * vWhlVelVec(eY); + vLocalForce(eX) = fabs(vLocalForce(eZ) * staticFCoeff) * vWhlVelVec(eX); + vLocalForce(eY) = fabs(vLocalForce(eZ) * staticFCoeff) * vWhlVelVec(eY); MaximumStrutForce = max(MaximumStrutForce, fabs(vLocalForce(eZ))); MaximumStrutTravel = max(MaximumStrutTravel, fabs(compressLength)); @@ -128,7 +139,6 @@ FGColumnVector FGLGear::Force(void) cout << " Force: " << vForce << endl; cout << " Moment: " << vMoment << endl; - } else { WOW = false; diff --git a/src/FDM/JSBSim/FGLGear.h b/src/FDM/JSBSim/FGLGear.h index 7c35914f4..9e8c46e16 100644 --- a/src/FDM/JSBSim/FGLGear.h +++ b/src/FDM/JSBSim/FGLGear.h @@ -92,6 +92,8 @@ public: inline float GetCompVel(void) {return compressSpeed; } inline float GetCompForce(void) {return Force()(3); } + inline void SetBrake(double bp) {brakePct = bp;} + inline void SetReport(bool bb) { ReportEnable=bb; } inline bool GetReport(void) { return ReportEnable; } @@ -101,10 +103,12 @@ private: FGColumnVector vXYZ; FGColumnVector vMoment; FGColumnVector vWhlBodyVec; - float kSpring, bDamp, compressLength, compressSpeed; - float statFCoeff, rollFCoeff, skidFCoeff; - float frictionForce, compForce; - float brakePct, brakeForce, brakeCoeff; + float kSpring; + float bDamp; + float compressLength; + float compressSpeed; + float staticFCoeff, dynamicFCoeff; + float brakePct; float maxCompLen; double SinkRate; double GroundSpeed; @@ -116,6 +120,10 @@ private: bool Reported; bool ReportEnable; string name; + string BrakeType; + string SteerType; + string GroupMember; + float maxSteerAngle; FGFDMExec* Exec; FGState* State; diff --git a/src/FDM/JSBSim/FGMassBalance.cpp b/src/FDM/JSBSim/FGMassBalance.cpp index 81a4eb9a8..4e534a54b 100644 --- a/src/FDM/JSBSim/FGMassBalance.cpp +++ b/src/FDM/JSBSim/FGMassBalance.cpp @@ -45,7 +45,7 @@ INCLUDES *******************************************************************************/ -FGMassBalance::FGMassBalance() : FGModel() +FGMassBalance::FGMassBalance(FGFDMExec* fdmex) : FGModel(fdmex) { // } diff --git a/src/FDM/JSBSim/FGMassBalance.h b/src/FDM/JSBSim/FGMassBalance.h index b2ed0c180..4d6ac9d79 100644 --- a/src/FDM/JSBSim/FGMassBalance.h +++ b/src/FDM/JSBSim/FGMassBalance.h @@ -52,7 +52,7 @@ class FGMassBalance : public FGModel { public: - FGMassBalance(); + FGMassBalance(FGFDMExec*); ~FGMassBalance(); bool Run(void); diff --git a/src/FDM/JSBSim/FGPiston.cpp b/src/FDM/JSBSim/FGPiston.cpp index 9cce927f6..0982ca2b7 100644 --- a/src/FDM/JSBSim/FGPiston.cpp +++ b/src/FDM/JSBSim/FGPiston.cpp @@ -45,7 +45,8 @@ INCLUDES *******************************************************************************/ -FGPiston::FGPiston() : FGEngine() +FGPiston::FGPiston(FGFDMExec* fdex, string enginePath, string engineName, int num) : + FGEngine(fdex, enginePath, engineName, num) { // } diff --git a/src/FDM/JSBSim/FGPiston.h b/src/FDM/JSBSim/FGPiston.h index 6437bb4a7..5e9c78cc7 100644 --- a/src/FDM/JSBSim/FGPiston.h +++ b/src/FDM/JSBSim/FGPiston.h @@ -52,7 +52,7 @@ class FGPiston : public FGEngine { public: - FGPiston(); + FGPiston(FGFDMExec*, string, string, int); ~FGPiston(); }; diff --git a/src/FDM/JSBSim/FGRocket.cpp b/src/FDM/JSBSim/FGRocket.cpp index f94487d45..6a219f802 100644 --- a/src/FDM/JSBSim/FGRocket.cpp +++ b/src/FDM/JSBSim/FGRocket.cpp @@ -45,7 +45,8 @@ INCLUDES *******************************************************************************/ -FGRocket::FGRocket() : FGEngine() +FGRocket::FGRocket(FGFDMExec* fdex, string enginePath, string engineName, int num) : + FGEngine(fdex, enginePath, engineName, num) { // } diff --git a/src/FDM/JSBSim/FGRocket.h b/src/FDM/JSBSim/FGRocket.h index 990bd31f5..119b20045 100644 --- a/src/FDM/JSBSim/FGRocket.h +++ b/src/FDM/JSBSim/FGRocket.h @@ -52,7 +52,7 @@ class FGRocket : public FGEngine { public: - FGRocket(); + FGRocket(FGFDMExec*, string, string, int); ~FGRocket(); }; diff --git a/src/FDM/JSBSim/FGTrim.cpp b/src/FDM/JSBSim/FGTrim.cpp index 4089ba909..78d4d8219 100644 --- a/src/FDM/JSBSim/FGTrim.cpp +++ b/src/FDM/JSBSim/FGTrim.cpp @@ -167,11 +167,15 @@ void FGTrim::ReportState(void) { sprintf(gear,"Down"); sprintf(out, " Flaps: %3s Gear: %4s\n",flap,gear); cout << out; - sprintf(out, " Speed: %4.0f KCAS Mach: %5.2f Altitude: %7.0f ft.\n", + sprintf(out, " Speed: %4.0f KCAS Mach: %5.2f\n", fdmex->GetAuxiliary()->GetVcalibratedKTS(), fdmex->GetState()->GetParameter(FG_MACH), fdmex->GetPosition()->Geth() ); cout << out; + sprintf(out, " Altitude: %7.0f ft. AGL Altitude: %7.0f ft.\n", + fdmex->GetPosition()->Geth(), + fdmex->GetPosition()->GetDistanceAGL() ); + cout << out; sprintf(out, " Angle of Attack: %6.2f deg Pitch Angle: %6.2f deg\n", fdmex->GetState()->GetParameter(FG_ALPHA)*RADTODEG, fdmex->GetRotation()->Gettht()*RADTODEG ); diff --git a/src/FDM/JSBSim/FGTurboJet.cpp b/src/FDM/JSBSim/FGTurboJet.cpp index a7ee4ecdc..4cc0accb4 100644 --- a/src/FDM/JSBSim/FGTurboJet.cpp +++ b/src/FDM/JSBSim/FGTurboJet.cpp @@ -45,7 +45,8 @@ INCLUDES *******************************************************************************/ -FGTurboJet::FGTurboJet() : FGEngine() +FGTurboJet::FGTurboJet(FGFDMExec* fdex, string enginePath, string engineName, int num) : + FGEngine(fdex, enginePath, engineName, num) { // } diff --git a/src/FDM/JSBSim/FGTurboJet.h b/src/FDM/JSBSim/FGTurboJet.h index 323498abf..b38637e7c 100644 --- a/src/FDM/JSBSim/FGTurboJet.h +++ b/src/FDM/JSBSim/FGTurboJet.h @@ -52,7 +52,7 @@ class FGTurboJet : public FGEngine { public: - FGTurboJet(); + FGTurboJet(FGFDMExec*, string, string, int); ~FGTurboJet(); }; diff --git a/src/FDM/JSBSim/FGTurboShaft.cpp b/src/FDM/JSBSim/FGTurboShaft.cpp index c83825460..572656f38 100644 --- a/src/FDM/JSBSim/FGTurboShaft.cpp +++ b/src/FDM/JSBSim/FGTurboShaft.cpp @@ -45,7 +45,8 @@ INCLUDES *******************************************************************************/ -FGTurboShaft::FGTurboShaft() : FGEngine() +FGTurboShaft::FGTurboShaft(FGFDMExec* fdex, string enginePath, string engineName, int num) : + FGEngine(fdex, enginePath, engineName, num) { // } diff --git a/src/FDM/JSBSim/FGTurboShaft.h b/src/FDM/JSBSim/FGTurboShaft.h index 832c14411..e19f43cc7 100644 --- a/src/FDM/JSBSim/FGTurboShaft.h +++ b/src/FDM/JSBSim/FGTurboShaft.h @@ -52,7 +52,7 @@ class FGTurboShaft : public FGEngine { public: - FGTurboShaft(); + FGTurboShaft(FGFDMExec*, string, string, int); ~FGTurboShaft(); }; diff --git a/src/FDM/JSBSim/JSBSim.cpp b/src/FDM/JSBSim/JSBSim.cpp index 8f898eb4f..99c9e1f6b 100644 --- a/src/FDM/JSBSim/JSBSim.cpp +++ b/src/FDM/JSBSim/JSBSim.cpp @@ -71,7 +71,6 @@ USEUNIT("filtersjb\FGGain.cpp"); USEUNIT("filtersjb\FGGradient.cpp"); USEUNIT("filtersjb\FGSummer.cpp"); USEUNIT("filtersjb\FGDeadBand.cpp"); -USEUNIT("FGTrimLong.cpp"); USEUNIT("filtersjb\FGFlaps.cpp"); USEFILE("JSBSim.cxx"); USEUNIT("FGForce.cpp"); diff --git a/src/FDM/JSBSim/filtersjb/FGFCSComponent.cpp b/src/FDM/JSBSim/filtersjb/FGFCSComponent.cpp index 22a0b37a7..48491ef66 100644 --- a/src/FDM/JSBSim/filtersjb/FGFCSComponent.cpp +++ b/src/FDM/JSBSim/filtersjb/FGFCSComponent.cpp @@ -54,10 +54,10 @@ FGFCSComponent::FGFCSComponent(FGFCS* _fcs) : fcs(_fcs) Type = ""; ID = 0; Input = 0.0; - InputIdx = FG_NOTHING; + InputIdx = FG_UNDEF; Output = 0.0; sOutputIdx = ""; - OutputIdx = FG_NOTHING; + OutputIdx = FG_UNDEF; IsOutput = false; } diff --git a/src/FDM/JSBSim/filtersjb/FGGain.cpp b/src/FDM/JSBSim/filtersjb/FGGain.cpp index 0744983f1..40b4fe4aa 100644 --- a/src/FDM/JSBSim/filtersjb/FGGain.cpp +++ b/src/FDM/JSBSim/filtersjb/FGGain.cpp @@ -59,7 +59,7 @@ FGGain::FGGain(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs), Schedule.clear(); Gain = 1.000; Min = Max = 0; - ScheduledBy = FG_NOTHING; + ScheduledBy = FG_UNDEF; Type = AC_cfg->GetValue("TYPE"); Name = AC_cfg->GetValue("NAME");