Changed the throttle and fixed the left motors spin

This commit is contained in:
Γιώργος Αντρέου 2025-06-22 00:06:30 +03:00
parent abe591f3b8
commit 4ecbb9ef90

View file

@ -58,12 +58,12 @@ while sonar.distance < 20:
break
print(">>>>> Starting movement!!!")
mot_right.throttle = 0.5
mot_left.throttle = 0.5
mot_right.throttle = 1
mot_left.throttle = - 1
while True:
# Find the motor revolutions
revleft = enc_left.position / COUNTS_PER_REV
revleft = - enc_left.position / COUNTS_PER_REV
revright = enc_right.position / COUNTS_PER_REV
distleft = revleft * circumference
@ -77,4 +77,9 @@ while True:
print("Target reached!!!")
mot_left.throttle = 0
mot_right.throttle = 0
break
break
mot_right.throttle = 1
mot_left.throttle = - 1
time.sleep(0.05)