]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/models/FGLGear.cpp
Andreas Gaeb: fix #222 (JSBSIm reset problems)
[flightgear.git] / src / FDM / JSBSim / models / FGLGear.cpp
index 569b76ee4f89aa1c63deb85e38e5abda391545be..596e495f0c6d1ea0daf5b395a53e482ffc70af4e 100644 (file)
@@ -48,6 +48,7 @@ INCLUDES
 #include "FGMassBalance.h"
 #include "math/FGTable.h"
 #include <cstdlib>
+#include <cstring>
 
 using namespace std;
 
@@ -61,7 +62,7 @@ DEFINITIONS
 GLOBAL DATA
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-static const char *IdSrc = "$Id: FGLGear.cpp,v 1.76 2010/07/30 11:50:01 jberndt Exp $";
+static const char *IdSrc = "$Id: FGLGear.cpp,v 1.79 2010/11/28 13:20:47 bcoconni Exp $";
 static const char *IdHdr = ID_LGEAR;
 
 // Body To Structural (body frame is rotated 180 deg about Y and lengths are given in
@@ -76,7 +77,8 @@ FGLGear::FGLGear(Element* el, FGFDMExec* fdmex, int number) :
   FGForce(fdmex),
   GearNumber(number),
   SteerAngle(0.0),
-  Castered(false)
+  Castered(false),
+  StaticFriction(false)
 {
   Element *force_table=0;
   Element *dampCoeff=0;
@@ -254,9 +256,7 @@ FGLGear::FGLGear(Element* el, FGFDMExec* fdmex, int number) :
   Curvature = 1.03;
 
   // Initialize Lagrange multipliers
-  LMultiplier[ftRoll].value = 0.;
-  LMultiplier[ftSide].value = 0.;
-  LMultiplier[ftRoll].value = 0.;
+  memset(LMultiplier, 0, sizeof(LMultiplier));
 
   Debug(0);
 }
@@ -281,13 +281,15 @@ FGColumnVector3& FGLGear::GetBodyForces(void)
   if (isRetractable) ComputeRetractionState();
 
   if (GearDown) {
+    FGColumnVector3 angularVel;
+
     vWhlBodyVec = MassBalance->StructuralToBody(vXYZn); // Get wheel in body frame
     vLocalGear = Propagate->GetTb2l() * vWhlBodyVec; // Get local frame wheel location
 
     gearLoc = Propagate->GetLocation().LocalToLocation(vLocalGear);
     // Compute the height of the theoretical location of the wheel (if strut is
     // not compressed) with respect to the ground level
-    double height = fdmex->GetGroundCallback()->GetAGLevel(t, gearLoc, contact, normal, cvel);
+    double height = fdmex->GetGroundCallback()->GetAGLevel(t, gearLoc, contact, normal, cvel, angularVel);
     vGroundNormal = Propagate->GetTec2b() * normal;
 
     // The height returned above is the AGL and is expressed in the Z direction
@@ -804,6 +806,10 @@ void FGLGear::bind(void)
 
     property_name = base_property_name + "/static_friction_coeff";
     fdmex->GetPropertyManager()->Tie( property_name.c_str(), &staticFCoeff );
+    property_name = base_property_name + "/rolling_friction_coeff";
+    fdmex->GetPropertyManager()->Tie( property_name.c_str(), &rollingFCoeff );
+    property_name = base_property_name + "/dynamic_friction_coeff";
+    fdmex->GetPropertyManager()->Tie( property_name.c_str(), &dynamicFCoeff );
 
     if (eSteerType == stCaster) {
       property_name = base_property_name + "/steering-angle-deg";