]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/YASim/Launchbar.cpp
latest updates from JSBSim
[flightgear.git] / src / FDM / YASim / Launchbar.cpp
index ebe599999026f50451d3a4049cdda7e0219a4e79..756e9a0345f02364712c5e720a278f3f8cd4e831 100644 (file)
@@ -2,14 +2,12 @@
 #include "BodyEnvironment.hpp"
 #include "Ground.hpp"
 #include "RigidBody.hpp"
-
 #include "Launchbar.hpp"
 
-using namespace std;
 namespace yasim {
 
-  static const float YASIM_PI2 = 3.14159265358979323846/2;
-  static const float YASIM_PI = 3.14159265358979323846;
+  static const float YASIM_PI2 = 3.14159265358979323846f/2;
+  static const float YASIM_PI = 3.14159265358979323846f;
   static const float RAD2DEG = 180/YASIM_PI;
 
 Launchbar::Launchbar()
@@ -33,6 +31,7 @@ Launchbar::Launchbar()
     _pos_on_cat = 0.0;
     _state = Unmounted;
     _strop = false;
+    _acceleration = 0.25;
 }
 
 void Launchbar::setLaunchbarMount(float* position)
@@ -77,6 +76,11 @@ void Launchbar::setLaunchCmd(bool cmd)
     _launch_cmd = cmd;
 }
 
+void Launchbar::setAcceleration(float acceleration)
+{
+    _acceleration = acceleration;
+}
+
 void Launchbar::setGlobalGround(double *global_ground)
 {
     int i;
@@ -246,7 +250,7 @@ void Launchbar::getPosOnCat(float perc, float* lpos, float* lvel,
     
     float tmp[3];
     Math::mul3(perc, lendvels[0], lvel);
-    Math::mul3(1.0-perc, lendvels[1], tmp);
+    Math::mul3(1.0f-perc, lendvels[1], tmp);
     Math::add3(tmp, lvel, lvel);
 }
 
@@ -380,7 +384,7 @@ void Launchbar::calcForce(Ground *g_cb, RigidBody* body, State* s, float* lv, fl
     float llbdir[3];
     Math::sub3(llbtip, _launchbar_mount, llbdir);
     float lblen = Math::mag3(llbdir);
-    Math::mul3(1.0/lblen, llbdir, llbdir);
+    Math::mul3(1.0f/lblen, llbdir, llbdir);
 
     // Check if we are near enough to the cat.
     if (_state == Unmounted && dist < 0.6) {
@@ -458,7 +462,7 @@ void Launchbar::calcForce(Ground *g_cb, RigidBody* body, State* s, float* lv, fl
 
             // The spring force the holdback will apply to the gear
             float tmp[3];
-        Math::mul3(1e1*(hldbklen - _holdback_length), lhldbkdir,
+        Math::mul3(10.f*(hldbklen - _holdback_length), lhldbkdir,
           _holdback_force);
 
             // The damping force here ...
@@ -474,7 +478,9 @@ void Launchbar::calcForce(Ground *g_cb, RigidBody* body, State* s, float* lv, fl
 
     if (_state == Launch) {
         // Now apply a constant tension from the catapult over the launchbar.
-      Math::mul3(25.0, llbdir, _launchbar_force);
+        // We modify the max accleration 100 m/s^2 by the normalised input
+        //SG_LOG(SG_FLIGHT, SG_ALERT, "acceleration " << 100 * _acceleration );
+        Math::mul3(100 * _acceleration, llbdir, _launchbar_force);
 
       if (1.0 < dist) {
         _state = Completed;