]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/models/FGLGear.h
Merge branch 'next' of git://gitorious.org/fg/flightgear into next
[flightgear.git] / src / FDM / JSBSim / models / FGLGear.h
index b7e2f1b83de5e55c08728bc9c8a47ad66a5a90e4..f1828f8cf840b17c4c7ffebc6ea90ac5022d8fec 100644 (file)
@@ -38,18 +38,16 @@ SENTRY
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#include <FGJSBBase.h>
-#include <FGFDMExec.h>
-#include <input_output/FGXMLElement.h>
-#include <math/FGColumnVector3.h>
-#include <math/FGTable.h>
+#include "models/propulsion/FGForce.h"
+#include "models/FGPropagate.h"
+#include "math/FGColumnVector3.h"
 #include <string>
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_LGEAR "$Id$"
+#define ID_LGEAR "$Id: FGLGear.h,v 1.41 2010/09/22 11:33:40 jberndt Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -60,9 +58,10 @@ namespace JSBSim {
 class FGAircraft;
 class FGPropagate;
 class FGFCS;
-class FGState;
 class FGMassBalance;
 class FGAuxiliary;
+class FGTable;
+class Element;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
@@ -85,7 +84,6 @@ CLASS DOCUMENTATION
     <h3>Operational Properties</h3>
     <ol>
     <li>Name</li>
-    <li>Steerability attribute {one of STEERABLE | FIXED | CASTERED}</li>
     <li>Brake Group Membership {one of LEFT | CENTER | RIGHT | NOSE | TAIL | NONE}</li>
     <li>Max Steer Angle, in degrees</li>
     </ol></p>
@@ -163,30 +161,26 @@ CLASS DOCUMENTATION
                 <y> {number} </y>
                 <z> {number} </z>
             </location>
+            <orientation unit="{RAD | DEG}">
+                <pitch> {number} </pitch>
+                <roll> {number} </roll>
+                <yaw> {number} </yaw>
+            </orientation>
             <static_friction> {number} </static_friction>
             <dynamic_friction> {number} </dynamic_friction>
             <rolling_friction> {number} </rolling_friction>
             <spring_coeff unit="{LBS/FT | N/M}"> {number} </spring_coeff>
-            <damping_coeff unit="{LBS/FT/SEC | N/M/SEC}"> {number} </damping_coeff>
-            <damping_coeff_rebound unit="{LBS/FT/SEC | N/M/SEC}"> {number} </damping_coeff_rebound>
+            <damping_coeff [type="SQUARE"] unit="{LBS/FT/SEC | N/M/SEC}"> {number} </damping_coeff>
+            <damping_coeff_rebound [type="SQUARE"] unit="{LBS/FT/SEC | N/M/SEC}"> {number} </damping_coeff_rebound>
             <max_steer unit="DEG"> {number | 0 | 360} </max_steer>
             <brake_group> {NONE | LEFT | RIGHT | CENTER | NOSE | TAIL} </brake_group>
             <retractable>{0 | 1}</retractable>
             <table type="{CORNERING_COEFF}">
             </table>
-            <relaxation_velocity>
-               <rolling unit="{FT/SEC | KTS | M/S}"> {number} </rolling>
-               <side unit="{FT/SEC | KTS | M/S}"> {number} </side>
-            </relaxation_velocity>
-            <force_lag_filter>
-               <rolling> {number} </rolling>
-               <side> {number} </side>
-            </force_lag_filter>
-            <wheel_slip_filter> {number} </wheel_slip_filter>  
         </contact>
 @endcode
     @author Jon S. Berndt
-    @version $Id$
+    @version $Id: FGLGear.h,v 1.41 2010/09/22 11:33:40 jberndt Exp $
     @see Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at
      NASA-Ames", NASA CR-2497, January 1975
     @see Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
@@ -199,7 +193,7 @@ CLASS DOCUMENTATION
 CLASS DECLARATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-class FGLGear : public FGJSBBase
+class FGLGear : public FGForce
 {
 public:
   /// Brake grouping enumerators
@@ -207,11 +201,13 @@ public:
   /// Steering group membership enumerators
   enum SteerType {stSteer, stFixed, stCaster};
   /// Contact point type
-  enum ContactType {ctBOGEY, ctSTRUCTURE, ctUNKNOWN};
+  enum ContactType {ctBOGEY, ctSTRUCTURE};
   /// Report type enumerators
   enum ReportType {erNone=0, erTakeoff, erLand};
   /// Damping types
   enum DampType {dtLinear=0, dtSquare};
+  /// Friction types
+  enum FrictionType {ftRoll=0, ftSide, ftDynamic};
   /** Constructor
       @param el a pointer to the XML element that contains the CONTACT info.
       @param Executive a pointer to the parent executive object
@@ -222,9 +218,7 @@ public:
   ~FGLGear();
 
   /// The Force vector for this gear
-  FGColumnVector3& Force(void);
-  /// The Moment vector for this gear
-  FGColumnVector3& Moment(void) {return vMoment;}
+  FGColumnVector3& GetBodyForces(void);
 
   /// Gets the location of the gear in Body axes
   FGColumnVector3& GetBodyLocation(void) { return vWhlBodyVec; }
@@ -269,35 +263,38 @@ public:
   int GetBrakeGroup(void) const { return (int)eBrakeGrp; }
   int GetSteerType(void) const  { return (int)eSteerType; }
 
-  double GetZPosition(void) const { return vXYZ(3); }
-  void SetZPosition(double z) { vXYZ(3) = z; }
-
-  bool GetSteerable(void) const { return eSteerType != stFixed; }
+  bool GetSteerable(void) const        { return eSteerType != stFixed; }
   bool GetRetractable(void) const      { return isRetractable;   }
   bool GetGearUnitUp(void) const       { return GearUp;          }
   bool GetGearUnitDown(void) const     { return GearDown;        }
-  double GetWheelSideForce(void) const { return vLocalForce(eY); }
-  double GetWheelRollForce(void) const { return vLocalForce(eX); }
-  double GetWheelSideVel(void) const   { return vWhlVelVec(eY);  }
-  double GetWheelRollVel(void) const   { return vWhlVelVec(eX);  }
-  double GetBodyXForce(void) const     { return vForce(eX);      }
-  double GetBodyYForce(void) const     { return vForce(eY);      }
+  double GetWheelRollForce(void) {
+    FGColumnVector3 vForce = mTGear.Transposed() * FGForce::GetBodyForces();
+    return vForce(eX)*cos(SteerAngle) + vForce(eY)*sin(SteerAngle); }
+  double GetWheelSideForce(void) {
+    FGColumnVector3 vForce = mTGear.Transposed() * FGForce::GetBodyForces();
+    return vForce(eY)*cos(SteerAngle) - vForce(eX)*sin(SteerAngle); }
+  double GetWheelRollVel(void) const   { return vWhlVelVec(eX)*cos(SteerAngle)
+                                              + vWhlVelVec(eY)*sin(SteerAngle);  }
+  double GetWheelSideVel(void) const   { return vWhlVelVec(eY)*cos(SteerAngle)
+                                              - vWhlVelVec(eX)*sin(SteerAngle);  }
   double GetWheelSlipAngle(void) const { return WheelSlip;       }
-  double GetWheelVel(int axis) const          { return vWhlVelVec(axis);}
-  bool IsBogey(void) const                    { return (eContactType == ctBOGEY);}
+  double GetWheelVel(int axis) const   { return vWhlVelVec(axis);}
+  bool IsBogey(void) const             { return (eContactType == ctBOGEY);}
   double GetGearUnitPos(void);
+  double GetSteerAngleDeg(void) const { return radtodeg*SteerAngle; }
+  FGPropagate::LagrangeMultiplier* GetMultiplierEntry(int entry);
+  void SetLagrangeMultiplier(double lambda, int entry);
+  FGColumnVector3& UpdateForces(void);
 
   void bind(void);
 
 private:
   int GearNumber;
-  FGMatrix33 Tg2b, Tb2g;
-  FGColumnVector3 vXYZ;
-  FGColumnVector3 vMoment;
+  static const FGMatrix33 Tb2s;
+  FGMatrix33 mTGear;
+  FGColumnVector3 vGearOrient;
   FGColumnVector3 vWhlBodyVec;
   FGColumnVector3 vLocalGear;
-  FGColumnVector3 vForce;
-  FGColumnVector3 vLocalForce;
   FGColumnVector3 vWhlVelVec, vLocalWhlVel;     // Velocity of this wheel
   FGColumnVector3 normal, cvel, vGroundNormal;
   FGLocation contact, gearLoc;
@@ -336,11 +333,13 @@ private:
   bool isRetractable;
   bool GearUp, GearDown;
   bool Servicable;
-  string name;
-  string sSteerType;
-  string sBrakeGroup;
-  string sRetractable;
-  string sContactType;
+  bool Castered;
+  bool StaticFriction;
+  std::string name;
+  std::string sSteerType;
+  std::string sBrakeGroup;
+  std::string sRetractable;
+  std::string sContactType;
 
   BrakeGroup  eBrakeGrp;
   ContactType eContactType;
@@ -348,23 +347,14 @@ private:
   DampType    eDampType;
   DampType    eDampTypeRebound;
   double  maxSteerAngle;
-  double RFRV;  // Rolling force relaxation velocity
-  double SFRV;  // Side force relaxation velocity
-  double LongForceLagFilterCoeff; // Longitudinal Force Lag Filter Coefficient
-  double LatForceLagFilterCoeff; // Lateral Force Lag Filter Coefficient
-  double WheelSlipLagFilterCoeff; // Wheel slip angle lag filter coefficient
-
-  Filter LongForceFilter;
-  Filter LatForceFilter;
-  Filter WheelSlipFilter;
-
-  FGFDMExec*     Exec;
-  FGState*       State;
-  FGAircraft*    Aircraft;
-  FGPropagate*   Propagate;
-  FGAuxiliary*   Auxiliary;
-  FGFCS*         FCS;
-  FGMassBalance* MassBalance;
+
+  FGPropagate::LagrangeMultiplier LMultiplier[3];
+
+  FGAuxiliary*       Auxiliary;
+  FGPropagate*       Propagate;
+  FGFCS*             FCS;
+  FGMassBalance*     MassBalance;
+  FGGroundReactions* GroundReactions;
 
   void ComputeRetractionState(void);
   void ComputeBrakeForceCoefficient(void);
@@ -373,6 +363,7 @@ private:
   void ComputeSideForceCoefficient(void);
   void ComputeVerticalStrutForce(void);
   void ComputeGroundCoordSys(void);
+  void ComputeJacobian(const FGColumnVector3& vWhlContactVec);
   void CrashDetect(void);
   void InitializeReporting(void);
   void ResetReporting(void);
@@ -381,12 +372,6 @@ private:
   void Debug(int from);
 };
 }
-#include "FGAircraft.h"
-#include "FGPropagate.h"
-#include "FGAuxiliary.h"
-#include "FGFCS.h"
-#include "FGMassBalance.h"
-#include "FGState.h"
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%