Update folkrace.py

This commit is contained in:
Γιώργος Αντρέου 2025-06-16 01:03:43 +03:00
parent 04552995d7
commit 05f48e8a3e

View file

@ -66,7 +66,7 @@ def turnleft():
while True: while True:
print("F=", f"{front.distance:.2f}", "R=", f"{right.distance:.2f}", "L=", f"{left.distance:.2f}") print("F=", f"{front.distance:.2f}", "R=", f"{right.distance:.2f}", "L=", f"{left.distance:.2f}")
try: try:
if front.distance >= 20: # What to do when there is an obstacle ahead if front.distance <= 20: # What to do when there is an obstacle ahead
if left.distance > right.distance: # Diagonally left if left.distance > right.distance: # Diagonally left
dgleft() dgleft()
if right.distance > left.distance: # Diagonally right if right.distance > left.distance: # Diagonally right