Synced with latest JSBSim cvs.
reinit fix from Norman.
This commit is contained in:
parent
d422a7bb7f
commit
4b6e8102a7
7 changed files with 114 additions and 44 deletions
|
@ -53,8 +53,9 @@ FGControls::~FGControls() {
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
// Revision 1.23 2001/04/02 01:12:38 curt
|
// Revision 1.24 2001/04/05 19:14:37 curt
|
||||||
// Latest jsbsim updates.
|
// Synced with latest JSBSim cvs.
|
||||||
|
// reinit fix from Norman.
|
||||||
//
|
//
|
||||||
// Revision 1.7 2001/03/22 14:10:24 jberndt
|
// Revision 1.7 2001/03/22 14:10:24 jberndt
|
||||||
// Fixed ID comment
|
// Fixed ID comment
|
||||||
|
|
|
@ -178,8 +178,9 @@ extern FGControls controls;
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
// Revision 1.22 2001/04/02 01:12:38 curt
|
// Revision 1.23 2001/04/05 19:14:37 curt
|
||||||
// Latest jsbsim updates.
|
// Synced with latest JSBSim cvs.
|
||||||
|
// reinit fix from Norman.
|
||||||
//
|
//
|
||||||
// Revision 1.10 2001/03/22 14:10:24 jberndt
|
// Revision 1.10 2001/03/22 14:10:24 jberndt
|
||||||
// Fixed ID comment
|
// Fixed ID comment
|
||||||
|
|
|
@ -94,7 +94,10 @@ enum eParam {
|
||||||
FG_THROTTLE_POS,
|
FG_THROTTLE_POS,
|
||||||
FG_ACTIVE_ENGINE,
|
FG_ACTIVE_ENGINE,
|
||||||
FG_HOVERB,
|
FG_HOVERB,
|
||||||
FG_PITCH_TRIM_CMD
|
FG_PITCH_TRIM_CMD,
|
||||||
|
FG_LEFT_BRAKE_CMD,
|
||||||
|
FG_CENTER_BRAKE_CMD,
|
||||||
|
FG_RIGHT_BRAKE_CMD
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eAction {
|
enum eAction {
|
||||||
|
|
|
@ -172,25 +172,32 @@ public:
|
||||||
/** Gets the aileron command.
|
/** Gets the aileron command.
|
||||||
@return aileron command in radians */
|
@return aileron command in radians */
|
||||||
inline float GetDaCmd(void) { return DaCmd; }
|
inline float GetDaCmd(void) { return DaCmd; }
|
||||||
|
|
||||||
/** Gets the elevator command.
|
/** Gets the elevator command.
|
||||||
@return elevator command in radians */
|
@return elevator command in radians */
|
||||||
inline float GetDeCmd(void) { return DeCmd; }
|
inline float GetDeCmd(void) { return DeCmd; }
|
||||||
|
|
||||||
/** Gets the rudder command.
|
/** Gets the rudder command.
|
||||||
@return rudder command in radians */
|
@return rudder command in radians */
|
||||||
inline float GetDrCmd(void) { return DrCmd; }
|
inline float GetDrCmd(void) { return DrCmd; }
|
||||||
|
|
||||||
/** Gets the flaps command.
|
/** Gets the flaps command.
|
||||||
@return flaps command in radians */
|
@return flaps command in radians */
|
||||||
inline float GetDfCmd(void) { return DfCmd; }
|
inline float GetDfCmd(void) { return DfCmd; }
|
||||||
|
|
||||||
/** Gets the speedbrake command.
|
/** Gets the speedbrake command.
|
||||||
@return speedbrake command in radians */
|
@return speedbrake command in radians */
|
||||||
inline float GetDsbCmd(void) { return DsbCmd; }
|
inline float GetDsbCmd(void) { return DsbCmd; }
|
||||||
|
|
||||||
/** Gets the spoiler command.
|
/** Gets the spoiler command.
|
||||||
@return spoiler command in radians */
|
@return spoiler command in radians */
|
||||||
inline float GetDspCmd(void) { return DspCmd; }
|
inline float GetDspCmd(void) { return DspCmd; }
|
||||||
|
|
||||||
/** Gets the throttle command.
|
/** Gets the throttle command.
|
||||||
@param engine engine ID number
|
@param engine engine ID number
|
||||||
@return throttle command in percent ( 0 - 100) for the given engine */
|
@return throttle command in percent ( 0 - 100) for the given engine */
|
||||||
inline float GetThrottleCmd(int engine) { return ThrottleCmd[engine]; }
|
inline float GetThrottleCmd(int engine) { return ThrottleCmd[engine]; }
|
||||||
|
|
||||||
/** Gets the pitch trim command.
|
/** Gets the pitch trim command.
|
||||||
@return pitch trim command in radians */
|
@return pitch trim command in radians */
|
||||||
inline float GetPitchTrimCmd(void) { return PTrimCmd; }
|
inline float GetPitchTrimCmd(void) { return PTrimCmd; }
|
||||||
|
@ -201,21 +208,27 @@ public:
|
||||||
/** Gets the aileron position.
|
/** Gets the aileron position.
|
||||||
@return aileron position in radians */
|
@return aileron position in radians */
|
||||||
inline float GetDaPos(void) { return DaPos; }
|
inline float GetDaPos(void) { return DaPos; }
|
||||||
|
|
||||||
/** Gets the elevator position.
|
/** Gets the elevator position.
|
||||||
@return elevator position in radians */
|
@return elevator position in radians */
|
||||||
inline float GetDePos(void) { return DePos; }
|
inline float GetDePos(void) { return DePos; }
|
||||||
|
|
||||||
/** Gets the rudder position.
|
/** Gets the rudder position.
|
||||||
@return rudder position in radians */
|
@return rudder position in radians */
|
||||||
inline float GetDrPos(void) { return DrPos; }
|
inline float GetDrPos(void) { return DrPos; }
|
||||||
|
|
||||||
/** Gets the flaps position.
|
/** Gets the flaps position.
|
||||||
@return flaps position in radians */
|
@return flaps position in radians */
|
||||||
inline float GetDfPos(void) { return DfPos; }
|
inline float GetDfPos(void) { return DfPos; }
|
||||||
|
|
||||||
/** Gets the speedbrake position.
|
/** Gets the speedbrake position.
|
||||||
@return speedbrake position in radians */
|
@return speedbrake position in radians */
|
||||||
inline float GetDsbPos(void) { return DsbPos; }
|
inline float GetDsbPos(void) { return DsbPos; }
|
||||||
|
|
||||||
/** Gets the spoiler position.
|
/** Gets the spoiler position.
|
||||||
@return spoiler position in radians */
|
@return spoiler position in radians */
|
||||||
inline float GetDspPos(void) { return DspPos; }
|
inline float GetDspPos(void) { return DspPos; }
|
||||||
|
|
||||||
/** Gets the throttle position.
|
/** Gets the throttle position.
|
||||||
@param engine engine ID number
|
@param engine engine ID number
|
||||||
@return throttle position for the given engine in percent ( 0 - 100)*/
|
@return throttle position for the given engine in percent ( 0 - 100)*/
|
||||||
|
@ -226,16 +239,20 @@ public:
|
||||||
This is used by the FGFCS-owned components.
|
This is used by the FGFCS-owned components.
|
||||||
@return pointer to the State object */
|
@return pointer to the State object */
|
||||||
inline FGState* GetState(void) { return State; }
|
inline FGState* GetState(void) { return State; }
|
||||||
|
|
||||||
/** Retrieves a components output value
|
/** Retrieves a components output value
|
||||||
@param idx the index of the component (the component ID)
|
@param idx the index of the component (the component ID)
|
||||||
@return output value from the component */
|
@return output value from the component */
|
||||||
float GetComponentOutput(eParam idx);
|
float GetComponentOutput(eParam idx);
|
||||||
|
|
||||||
/** Retrieves the component name
|
/** Retrieves the component name
|
||||||
@param idx the index of the component (the component ID)
|
@param idx the index of the component (the component ID)
|
||||||
@return name of the component */
|
@return name of the component */
|
||||||
string GetComponentName(int idx);
|
string GetComponentName(int idx);
|
||||||
|
|
||||||
/** Retrieves all component names for inclusion in output stream */
|
/** Retrieves all component names for inclusion in output stream */
|
||||||
string GetComponentStrings(void);
|
string GetComponentStrings(void);
|
||||||
|
|
||||||
/** Retrieves all component outputs for inclusion in output stream */
|
/** Retrieves all component outputs for inclusion in output stream */
|
||||||
string GetComponentValues(void);
|
string GetComponentValues(void);
|
||||||
|
|
||||||
|
@ -244,24 +261,31 @@ public:
|
||||||
/** Sets the aileron command
|
/** Sets the aileron command
|
||||||
@param cmd aileron command in radians*/
|
@param cmd aileron command in radians*/
|
||||||
inline void SetDaCmd(float cmd) { DaCmd = cmd; }
|
inline void SetDaCmd(float cmd) { DaCmd = cmd; }
|
||||||
|
|
||||||
/** Sets the elevator command
|
/** Sets the elevator command
|
||||||
@param cmd elevator command in radians*/
|
@param cmd elevator command in radians*/
|
||||||
inline void SetDeCmd(float cmd) { DeCmd = cmd; }
|
inline void SetDeCmd(float cmd) { DeCmd = cmd; }
|
||||||
|
|
||||||
/** Sets the rudder command
|
/** Sets the rudder command
|
||||||
@param cmd rudder command in radians*/
|
@param cmd rudder command in radians*/
|
||||||
inline void SetDrCmd(float cmd) { DrCmd = cmd; }
|
inline void SetDrCmd(float cmd) { DrCmd = cmd; }
|
||||||
|
|
||||||
/** Sets the flaps command
|
/** Sets the flaps command
|
||||||
@param cmd flaps command in radians*/
|
@param cmd flaps command in radians*/
|
||||||
inline void SetDfCmd(float cmd) { DfCmd = cmd; }
|
inline void SetDfCmd(float cmd) { DfCmd = cmd; }
|
||||||
|
|
||||||
/** Sets the speedbrake command
|
/** Sets the speedbrake command
|
||||||
@param cmd speedbrake command in radians*/
|
@param cmd speedbrake command in radians*/
|
||||||
inline void SetDsbCmd(float cmd) { DsbCmd = cmd; }
|
inline void SetDsbCmd(float cmd) { DsbCmd = cmd; }
|
||||||
|
|
||||||
/** Sets the spoilers command
|
/** Sets the spoilers command
|
||||||
@param cmd spoilers command in radians*/
|
@param cmd spoilers command in radians*/
|
||||||
inline void SetDspCmd(float cmd) { DspCmd = cmd; }
|
inline void SetDspCmd(float cmd) { DspCmd = cmd; }
|
||||||
|
|
||||||
/** Sets the pitch trim command
|
/** Sets the pitch trim command
|
||||||
@param cmd pitch trim command in radians*/
|
@param cmd pitch trim command in radians*/
|
||||||
inline void SetPitchTrimCmd(float cmd) { PTrimCmd = cmd; }
|
inline void SetPitchTrimCmd(float cmd) { PTrimCmd = cmd; }
|
||||||
|
|
||||||
/** Sets the throttle command for the specified engine
|
/** Sets the throttle command for the specified engine
|
||||||
@param engine engine ID number
|
@param engine engine ID number
|
||||||
@param cmd throttle command in percent (0 - 100)*/
|
@param cmd throttle command in percent (0 - 100)*/
|
||||||
|
@ -273,21 +297,27 @@ public:
|
||||||
/** Sets the aileron position
|
/** Sets the aileron position
|
||||||
@param cmd aileron position in radians*/
|
@param cmd aileron position in radians*/
|
||||||
inline void SetDaPos(float cmd) { DaPos = cmd; }
|
inline void SetDaPos(float cmd) { DaPos = cmd; }
|
||||||
|
|
||||||
/** Sets the elevator position
|
/** Sets the elevator position
|
||||||
@param cmd elevator position in radians*/
|
@param cmd elevator position in radians*/
|
||||||
inline void SetDePos(float cmd) { DePos = cmd; }
|
inline void SetDePos(float cmd) { DePos = cmd; }
|
||||||
|
|
||||||
/** Sets the rudder position
|
/** Sets the rudder position
|
||||||
@param cmd rudder position in radians*/
|
@param cmd rudder position in radians*/
|
||||||
inline void SetDrPos(float cmd) { DrPos = cmd; }
|
inline void SetDrPos(float cmd) { DrPos = cmd; }
|
||||||
|
|
||||||
/** Sets the flaps position
|
/** Sets the flaps position
|
||||||
@param cmd flaps position in radians*/
|
@param cmd flaps position in radians*/
|
||||||
inline void SetDfPos(float cmd) { DfPos = cmd; }
|
inline void SetDfPos(float cmd) { DfPos = cmd; }
|
||||||
|
|
||||||
/** Sets the speedbrake position
|
/** Sets the speedbrake position
|
||||||
@param cmd speedbrake position in radians*/
|
@param cmd speedbrake position in radians*/
|
||||||
inline void SetDsbPos(float cmd) { DsbPos = cmd; }
|
inline void SetDsbPos(float cmd) { DsbPos = cmd; }
|
||||||
|
|
||||||
/** Sets the spoiler position
|
/** Sets the spoiler position
|
||||||
@param cmd spoiler position in radians*/
|
@param cmd spoiler position in radians*/
|
||||||
inline void SetDspPos(float cmd) { DspPos = cmd; }
|
inline void SetDspPos(float cmd) { DspPos = cmd; }
|
||||||
|
|
||||||
/** Sets the actual throttle setting for the specified engine
|
/** Sets the actual throttle setting for the specified engine
|
||||||
@param engine engine ID number
|
@param engine engine ID number
|
||||||
@param cmd throttle setting in percent (0 - 100)*/
|
@param cmd throttle setting in percent (0 - 100)*/
|
||||||
|
@ -299,12 +329,15 @@ public:
|
||||||
/** Sets the left brake group
|
/** Sets the left brake group
|
||||||
@param cmd brake setting in percent (0.0 - 1.0) */
|
@param cmd brake setting in percent (0.0 - 1.0) */
|
||||||
void SetLBrake(float cmd) {LeftBrake = cmd;}
|
void SetLBrake(float cmd) {LeftBrake = cmd;}
|
||||||
|
|
||||||
/** Sets the right brake group
|
/** Sets the right brake group
|
||||||
@param cmd brake setting in percent (0.0 - 1.0) */
|
@param cmd brake setting in percent (0.0 - 1.0) */
|
||||||
void SetRBrake(float cmd) {RightBrake = cmd;}
|
void SetRBrake(float cmd) {RightBrake = cmd;}
|
||||||
|
|
||||||
/** Sets the center brake group
|
/** Sets the center brake group
|
||||||
@param cmd brake setting in percent (0.0 - 1.0) */
|
@param cmd brake setting in percent (0.0 - 1.0) */
|
||||||
void SetCBrake(float cmd) {CenterBrake = cmd;}
|
void SetCBrake(float cmd) {CenterBrake = cmd;}
|
||||||
|
|
||||||
/** Gets the brake for a specified group.
|
/** Gets the brake for a specified group.
|
||||||
@param bg which brakegroup to retrieve the command for
|
@param bg which brakegroup to retrieve the command for
|
||||||
@return the brake setting for the supplied brake group argument */
|
@return the brake setting for the supplied brake group argument */
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
Module: FGLGear.cpp
|
Module: FGLGear.cpp
|
||||||
Author: Jon S. Berndt
|
Author: Jon S. Berndt
|
||||||
|
Norman H. Princen
|
||||||
Date started: 11/18/99
|
Date started: 11/18/99
|
||||||
Purpose: Encapsulates the landing gear elements
|
Purpose: Encapsulates the landing gear elements
|
||||||
Called by: FGAircraft
|
Called by: FGAircraft
|
||||||
|
@ -184,32 +185,48 @@ FGColumnVector FGLGear::Force(void)
|
||||||
|
|
||||||
FGColumnVector vForce(3);
|
FGColumnVector vForce(3);
|
||||||
FGColumnVector vLocalForce(3);
|
FGColumnVector vLocalForce(3);
|
||||||
//FGColumnVector vLocalGear(3); // Vector: CG to this wheel (Local)
|
|
||||||
FGColumnVector vWhlVelVec(3); // Velocity of this wheel (Local)
|
FGColumnVector vWhlVelVec(3); // Velocity of this wheel (Local)
|
||||||
|
|
||||||
vWhlBodyVec = (vXYZ - Aircraft->GetXYZcg()) / 12.0;
|
vWhlBodyVec = (vXYZ - Aircraft->GetXYZcg()) / 12.0;
|
||||||
vWhlBodyVec(eX) = -vWhlBodyVec(eX);
|
vWhlBodyVec(eX) = -vWhlBodyVec(eX);
|
||||||
vWhlBodyVec(eZ) = -vWhlBodyVec(eZ);
|
vWhlBodyVec(eZ) = -vWhlBodyVec(eZ);
|
||||||
|
|
||||||
|
// vWhlBodyVec now stores the vector from the cg to this wheel
|
||||||
|
|
||||||
vLocalGear = State->GetTb2l() * vWhlBodyVec;
|
vLocalGear = State->GetTb2l() * vWhlBodyVec;
|
||||||
|
|
||||||
// For now, gear compression is assumed to happen in the Local Z axis,
|
// vLocalGear now stores the vector from the cg to the wheel in local coords.
|
||||||
// not the strut axis as it should be. Will fix this later.
|
|
||||||
|
|
||||||
compressLength = vLocalGear(eZ) - Position->GetDistanceAGL();
|
compressLength = vLocalGear(eZ) - Position->GetDistanceAGL();
|
||||||
|
|
||||||
|
// The compression length is currently measured in the Z-axis, only, at this time.
|
||||||
|
// It should be measured along the strut axis. If the local-frame gear position
|
||||||
|
// "hangs down" below the CG greater than the altitude, then the compressLength
|
||||||
|
// will be positive - i.e. the gear will have made contact.
|
||||||
|
|
||||||
if (compressLength > 0.00) {
|
if (compressLength > 0.00) {
|
||||||
|
|
||||||
WOW = true;
|
WOW = true; // Weight-On-Wheels is true
|
||||||
|
|
||||||
// The next equation should really use the vector to the contact patch of the tire
|
// The next equation should really use the vector to the contact patch of the tire
|
||||||
// including the strut compression and not vWhlBodyVec. Will fix this later.
|
// including the strut compression and not vWhlBodyVec. Will fix this later.
|
||||||
|
// As it stands, now, the following equation takes the aircraft body-frame
|
||||||
|
// rotational rate and calculates the cross-product with the vector from the CG
|
||||||
|
// to the wheel, thus producing the instantaneous velocity vector of the tire
|
||||||
|
// in Body coords. The frame is also converted to local coordinates. When the
|
||||||
|
// aircraft local-frame velocity is added to this quantity, the total velocity of
|
||||||
|
// the wheel in local frame is then known. Subsequently, the compression speed
|
||||||
|
// (used for calculating damping force) is found by taking the Z-component of the
|
||||||
|
// wheel velocity.
|
||||||
|
|
||||||
vWhlVelVec = State->GetTb2l() * (Rotation->GetPQR() * vWhlBodyVec);
|
vWhlVelVec = State->GetTb2l() * (Rotation->GetPQR() * vWhlBodyVec);
|
||||||
vWhlVelVec += Position->GetVel();
|
vWhlVelVec += Position->GetVel();
|
||||||
|
|
||||||
compressSpeed = vWhlVelVec(eZ);
|
compressSpeed = vWhlVelVec(eZ);
|
||||||
|
|
||||||
|
// If this is the first time the wheel has made contact, remember some values
|
||||||
|
// for later printout.
|
||||||
|
|
||||||
if (!FirstContact) {
|
if (!FirstContact) {
|
||||||
FirstContact = true;
|
FirstContact = true;
|
||||||
SinkRate = compressSpeed;
|
SinkRate = compressSpeed;
|
||||||
|
@ -220,43 +237,42 @@ FGColumnVector FGLGear::Force(void)
|
||||||
// steering The BrakeFCoeff formula assumes that an anti-skid system is used.
|
// steering The BrakeFCoeff formula assumes that an anti-skid system is used.
|
||||||
// It also assumes that we won't be turning and braking at the same time.
|
// It also assumes that we won't be turning and braking at the same time.
|
||||||
// Will fix this later.
|
// Will fix this later.
|
||||||
|
// [JSB] The braking force coefficients include normal rolling coefficient +
|
||||||
|
// a percentage of the static friction coefficient based on braking applied.
|
||||||
|
|
||||||
switch (eBrakeGrp) {
|
switch (eBrakeGrp) {
|
||||||
case bgLeft:
|
case bgLeft:
|
||||||
SteerGain = -maxSteerAngle;
|
SteerGain = -maxSteerAngle;
|
||||||
BrakeFCoeff = rollingFCoeff*(1.0 - FCS->GetBrake(bgLeft)) +
|
BrakeFCoeff = rollingFCoeff*(1.0 - FCS->GetBrake(bgLeft)) +
|
||||||
staticFCoeff*FCS->GetBrake(bgLeft);
|
staticFCoeff*FCS->GetBrake(bgLeft);
|
||||||
break;
|
break;
|
||||||
case bgRight:
|
case bgRight:
|
||||||
SteerGain = -maxSteerAngle;
|
SteerGain = -maxSteerAngle;
|
||||||
BrakeFCoeff = rollingFCoeff*(1.0 - FCS->GetBrake(bgRight)) +
|
BrakeFCoeff = rollingFCoeff*(1.0 - FCS->GetBrake(bgRight)) +
|
||||||
staticFCoeff*FCS->GetBrake(bgRight);
|
staticFCoeff*FCS->GetBrake(bgRight);
|
||||||
break;
|
break;
|
||||||
case bgCenter:
|
case bgCenter:
|
||||||
SteerGain = -maxSteerAngle;
|
SteerGain = -maxSteerAngle;
|
||||||
BrakeFCoeff = rollingFCoeff*(1.0 - FCS->GetBrake(bgCenter)) +
|
BrakeFCoeff = rollingFCoeff*(1.0 - FCS->GetBrake(bgCenter)) +
|
||||||
staticFCoeff*FCS->GetBrake(bgCenter);
|
staticFCoeff*FCS->GetBrake(bgCenter);
|
||||||
break;
|
break;
|
||||||
case bgNose:
|
case bgNose:
|
||||||
SteerGain = maxSteerAngle;
|
SteerGain = maxSteerAngle;
|
||||||
BrakeFCoeff = rollingFCoeff;
|
BrakeFCoeff = rollingFCoeff;
|
||||||
break;
|
break;
|
||||||
case bgTail:
|
case bgTail:
|
||||||
SteerGain = -maxSteerAngle;
|
SteerGain = -maxSteerAngle;
|
||||||
BrakeFCoeff = rollingFCoeff;
|
BrakeFCoeff = rollingFCoeff;
|
||||||
break;
|
break;
|
||||||
case bgNone:
|
case bgNone:
|
||||||
SteerGain = -maxSteerAngle;
|
SteerGain = -maxSteerAngle;
|
||||||
BrakeFCoeff = rollingFCoeff;
|
BrakeFCoeff = rollingFCoeff;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
cerr << "Improper brake group membership detected for this gear." << endl;
|
cerr << "Improper brake group membership detected for this gear." << endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note to Jon: Need to substitute the correct variable for RudderPedal.
|
|
||||||
// It is assumed that rudder pedal has a range of -1.0 to 1.0.
|
|
||||||
|
|
||||||
switch (eSteerType) {
|
switch (eSteerType) {
|
||||||
case stSteer:
|
case stSteer:
|
||||||
SteerAngle = SteerGain*FCS->GetDrCmd();
|
SteerAngle = SteerGain*FCS->GetDrCmd();
|
||||||
|
@ -265,7 +281,6 @@ FGColumnVector FGLGear::Force(void)
|
||||||
SteerAngle = 0.0;
|
SteerAngle = 0.0;
|
||||||
break;
|
break;
|
||||||
case stCaster:
|
case stCaster:
|
||||||
|
|
||||||
// Note to Jon: This is not correct for castering gear. I'll fix it later.
|
// Note to Jon: This is not correct for castering gear. I'll fix it later.
|
||||||
SteerAngle = 0.0;
|
SteerAngle = 0.0;
|
||||||
break;
|
break;
|
||||||
|
@ -277,7 +292,6 @@ FGColumnVector FGLGear::Force(void)
|
||||||
// Transform the wheel velocities from the local axis system to the wheel axis system.
|
// Transform the wheel velocities from the local axis system to the wheel axis system.
|
||||||
// For now, steering angle is assumed to happen in the Local Z axis,
|
// For now, steering angle is assumed to happen in the Local Z axis,
|
||||||
// not the strut axis as it should be. Will fix this later.
|
// not the strut axis as it should be. Will fix this later.
|
||||||
// Note to Jon: Please substitute the correct variable for Deg2Rad conversion.
|
|
||||||
|
|
||||||
SinWheel = sin(Rotation->Getpsi() + SteerAngle*DEGTORAD);
|
SinWheel = sin(Rotation->Getpsi() + SteerAngle*DEGTORAD);
|
||||||
CosWheel = cos(Rotation->Getpsi() + SteerAngle*DEGTORAD);
|
CosWheel = cos(Rotation->Getpsi() + SteerAngle*DEGTORAD);
|
||||||
|
@ -292,11 +306,11 @@ FGColumnVector FGLGear::Force(void)
|
||||||
WheelSlip = RADTODEG*atan2(SideWhlVel, RollingWhlVel);
|
WheelSlip = RADTODEG*atan2(SideWhlVel, RollingWhlVel);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The following code normalizes the wheel velocity vector, reverses it, and zeroes out
|
// 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
|
// 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
|
// 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 now points as a unit vector backwards and parallel to the wheel
|
||||||
// velocity vector. It acts AT the wheel.
|
// velocity vector. It acts AT the wheel.
|
||||||
|
|
||||||
// Note to Jon: I commented out this line because I wasn't sure we want to do this.
|
// Note to Jon: I commented out this line because I wasn't sure we want to do this.
|
||||||
// vWhlVelVec = -1.0 * vWhlVelVec.Normalize();
|
// vWhlVelVec = -1.0 * vWhlVelVec.Normalize();
|
||||||
|
@ -323,7 +337,7 @@ FGColumnVector FGLGear::Force(void)
|
||||||
// Compute the forces in the wheel ground plane.
|
// Compute the forces in the wheel ground plane.
|
||||||
|
|
||||||
RollingForce = 0;
|
RollingForce = 0;
|
||||||
if(fabs(RollingWhlVel) > 1E-3) {
|
if (fabs(RollingWhlVel) > 1E-3) {
|
||||||
RollingForce = vLocalForce(eZ) * BrakeFCoeff * fabs(RollingWhlVel)/RollingWhlVel;
|
RollingForce = vLocalForce(eZ) * BrakeFCoeff * fabs(RollingWhlVel)/RollingWhlVel;
|
||||||
}
|
}
|
||||||
SideForce = vLocalForce(eZ) * FCoeff;
|
SideForce = vLocalForce(eZ) * FCoeff;
|
||||||
|
|
|
@ -131,6 +131,9 @@ FGState::FGState(FGFDMExec* fdex) : mTb2l(3,3),
|
||||||
RegisterVariable(FG_ACTIVE_ENGINE, " active_engine " );
|
RegisterVariable(FG_ACTIVE_ENGINE, " active_engine " );
|
||||||
RegisterVariable(FG_HOVERB, " height/span " );
|
RegisterVariable(FG_HOVERB, " height/span " );
|
||||||
RegisterVariable(FG_PITCH_TRIM_CMD, " pitch_trim_cmd " );
|
RegisterVariable(FG_PITCH_TRIM_CMD, " pitch_trim_cmd " );
|
||||||
|
RegisterVariable(FG_LEFT_BRAKE_CMD, " left_brake_cmd " );
|
||||||
|
RegisterVariable(FG_RIGHT_BRAKE_CMD," right_brake_cmd ");
|
||||||
|
RegisterVariable(FG_CENTER_BRAKE_CMD," center_brake_cmd ");
|
||||||
|
|
||||||
if (debug_lvl & 2) cout << "Instantiated: FGState" << endl;
|
if (debug_lvl & 2) cout << "Instantiated: FGState" << endl;
|
||||||
}
|
}
|
||||||
|
@ -287,6 +290,16 @@ void FGState::SetParameter(eParam val_idx, float val) {
|
||||||
ActiveEngine = (int)val;
|
ActiveEngine = (int)val;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case FG_LEFT_BRAKE_CMD:
|
||||||
|
FDMExec->GetFCS()->SetLBrake(val);
|
||||||
|
break;
|
||||||
|
case FG_CENTER_BRAKE_CMD:
|
||||||
|
FDMExec->GetFCS()->SetCBrake(val);
|
||||||
|
break;
|
||||||
|
case FG_RIGHT_BRAKE_CMD:
|
||||||
|
FDMExec->GetFCS()->SetRBrake(val);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
cerr << "Parameter '" << val_idx << "' (" << paramdef[val_idx] << ") not handled" << endl;
|
cerr << "Parameter '" << val_idx << "' (" << paramdef[val_idx] << ") not handled" << endl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -817,6 +817,11 @@ void fgReInitSubsystems( void )
|
||||||
controls.reset_all();
|
controls.reset_all();
|
||||||
current_autopilot->reset();
|
current_autopilot->reset();
|
||||||
|
|
||||||
|
fgUpdateSunPos();
|
||||||
|
fgUpdateMoonPos();
|
||||||
|
cur_light_params.Update();
|
||||||
|
fgUpdateLocalTime();
|
||||||
|
|
||||||
if( !freeze )
|
if( !freeze )
|
||||||
globals->set_freeze( false );
|
globals->set_freeze( false );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue