Applied fixes to autopush

Signed-off-by: merspieler <merspieler@airmail.cc>
This commit is contained in:
merspieler 2018-12-24 02:22:20 +00:00
parent 31fb75dd25
commit 8564a747b8
2 changed files with 3 additions and 3 deletions

View file

@ -42,7 +42,7 @@ var _loop = func() {
var time = getprop("/sim/time/elapsed-sec"); var time = getprop("/sim/time/elapsed-sec");
var prop = math.min(math.max(_K_p * deltaV, -_F_p), _F_p); var prop = math.min(math.max(_K_p * deltaV, -_F_p), _F_p);
var speedup = getprop("/sim/speed-up"); var speedup = getprop("/sim/speed-up");
var deriv = 0; var deriv = 0.0;
dt = time - _time; dt = time - _time;
# XXX Sanitising dt. Smaller chance of freakout on lag spike. # XXX Sanitising dt. Smaller chance of freakout on lag spike.
if(dt > 0.0) { 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); _int = math.min(math.max(_int + _K_i * dV * dt, -_F_i), _F_i);
} }
if(dt > 0.002) { 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; var accel = prop + _int + deriv;

View file

@ -34,7 +34,7 @@ var _loop = func() {
D *= NM2M; D *= NM2M;
# FIXME Use _K_V and total remaining distance. # FIXME Use _K_V and total remaining distance.
var V = _F_V; 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; _to_wp += 1;
if (_to_wp == size(_route)) { if (_to_wp == size(_route)) {
_done(); _done();