diff --git a/Nasal/auto_speed.nas b/Nasal/auto_speed.nas index 2bf562d..afaf1bd 100644 --- a/Nasal/auto_speed.nas +++ b/Nasal/auto_speed.nas @@ -18,7 +18,7 @@ var autoSpeedMainLoop = func(){ var throttle = 0; var brakes = 0; #//range from 0 to 1; if(deltaSpeed > 0){ - throttle = (deltaSpeed / targetSpeed) - 0.05; #// Max throttle 0.95 + throttle = calculateThrottle(deltaSpeed / targetSpeed); #// Max throttle 0.9 }else if(deltaSpeed <= -1.852){ throttle = 0; brakes = ((0 - deltaSpeed) / targetSpeed) - 0.2; #// Max brake 0.8 @@ -31,6 +31,10 @@ var autoSpeedMainLoop = func(){ lastDeltaSpeed = deltaSpeed; } +var calculateThrottle = func(x){ + return x/(x+0.1); +} + var autoSpeedTimer = maketimer(0.05,autoSpeedMainLoop); var startAutoSpeed = func(){