diff --git a/Nasal/autopush.nas b/Nasal/autopush.nas index d024c7e2..02bdf7f1 100644 --- a/Nasal/autopush.nas +++ b/Nasal/autopush.nas @@ -42,7 +42,7 @@ var _loop = func() { var time = getprop("/sim/time/elapsed-sec"); var prop = math.min(math.max(_K_p * deltaV, -_F_p), _F_p); var speedup = getprop("/sim/speed-up"); - var deriv = 0; + var deriv = 0.0; dt = time - _time; # XXX Sanitising dt. Smaller chance of freakout on lag spike. if(dt > 0.0) { @@ -50,7 +50,7 @@ var _loop = func() { _int = math.min(math.max(_int + _K_i * dV * dt, -_F_i), _F_i); } if(dt > 0.002) { - var deriv = math.min(math.max(_K_d * dV / dt, -_F_d), _F_d); + deriv = math.min(math.max(_K_d * dV / dt, -_F_d), _F_d); } } var accel = prop + _int + deriv; diff --git a/Nasal/autopush_driver.nas b/Nasal/autopush_driver.nas index 53170c27..5d6577cd 100644 --- a/Nasal/autopush_driver.nas +++ b/Nasal/autopush_driver.nas @@ -34,7 +34,7 @@ var _loop = func() { D *= NM2M; # FIXME Use _K_V and total remaining distance. var V = _F_V; - if ((D < _D_min) or (abs(geo.normdeg180(A - psi) > 90.0))) { + if ((D < _D_min) or (abs(geo.normdeg180(A - psi) > 45.0))) { _to_wp += 1; if (_to_wp == size(_route)) { _done();