]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGTrimAxis.cpp
Encapsulate the interpolstion version of FGEnvironment and fix some bugs
[flightgear.git] / src / FDM / JSBSim / FGTrimAxis.cpp
index 485dbd5c2ed5e10ea908e3fa231761a39623f955..e95d1c54bfc0e564f268172178d6e592be3d2643 100644 (file)
@@ -48,6 +48,8 @@ INCLUDES
 #include "FGAerodynamics.h"
 
 
+namespace JSBSim {
+
 static const char *IdSrc = "$Id$";
 static const char *IdHdr = ID_TRIMAXIS;
 
@@ -321,22 +323,24 @@ bool FGTrimAxis::initTheta(void) {
   level=false;
   theta=fgic->GetPitchAngleDegIC(); 
   while(!level && (i < 100)) {
-       theta+=2.0*zDiff;
-       fgic->SetPitchAngleDegIC(theta);   
-       fdmex->RunIC();
-       zAft=fdmex->GetGroundReactions()->GetGearUnit(1)->GetLocalGear(3);
-        zForward=fdmex->GetGroundReactions()->GetGearUnit(0)->GetLocalGear(3);
-        zDiff = zForward - zAft;
-       //cout << endl << theta << "  " << zDiff << endl;
-       //cout << "0: " << fdmex->GetGroundReactions()->GetGearUnit(0)->GetLocalGear() << endl;
-       //cout << "1: " << fdmex->GetGroundReactions()->GetGearUnit(1)->GetLocalGear() << endl;
-
-       if(fabs(zDiff ) < 0.1) 
-           level=true;
-       i++;   
+         theta+=2.0*zDiff;
+         fgic->SetPitchAngleDegIC(theta);   
+         fdmex->RunIC();
+         zAft=fdmex->GetGroundReactions()->GetGearUnit(iAft)->GetLocalGear(3);
+    zForward=fdmex->GetGroundReactions()->GetGearUnit(iForward)->GetLocalGear(3);
+    zDiff = zForward - zAft;
+         //cout << endl << theta << "  " << zDiff << endl;
+         //cout << "0: " << fdmex->GetGroundReactions()->GetGearUnit(0)->GetLocalGear() << endl;
+         //cout << "1: " << fdmex->GetGroundReactions()->GetGearUnit(1)->GetLocalGear() << endl;
+         if(fabs(zDiff ) < 0.1) 
+             level=true;
+         i++;   
   }                    
   //cout << i << endl;
-  cout << "    Initial Theta: " << fdmex->GetRotation()->Gettht()*radtodeg << endl;
+  if (debug_lvl > 0) {
+      cout << "    Initial Theta: " << fdmex->GetRotation()->Gettht()*radtodeg << endl;
+      cout << "    Used gear unit " << iAft << " as aft and " << iForward << " as forward" << endl;
+  }
   control_min=(theta+5)*degtorad;
   control_max=(theta-5)*degtorad;
   fgic->SetAltitudeAGLFtIC(saveAlt);
@@ -482,5 +486,4 @@ void FGTrimAxis::Debug(int from)
     }
   }
 }
-
-
+}