speed should accumulate correctly

master
Marek Baczynski 6 years ago
parent 06e405c86c
commit dd289bbb16

@ -191,7 +191,7 @@ friction = 0.95
movement_time = 3
max_movement_time = 5
min_speed = 1
max_speed = 100
max_speed = 50
speed = 0
stopTime = 0
@ -202,8 +202,8 @@ def adjustSpeed(motor, adjustment):
global nowTime, stopTime, currentMotor, speed, motorcfg, movement_time, max_speed, max_movement_time
if currentMotor==motor:
if (adjustment>0 and speed>0) or (adjustment<0 and speed<0):
speed += adjustment * (abs(speed)/max_speed)
if (adjustment>0 and speed>0) or (adjustment<0 and speed<0):=
speed += adjustment * 1-(abs(speed)/max_speed)
else:
stopMotorFunctions()
stopTime += movement_time/2 * max_movement_time/(stopTime - nowTime)

Loading…
Cancel
Save