adligeerik 6 years ago
commit 78edcbd44b

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

Loading…
Cancel
Save