← Back to ratslair.com
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdvin <[email protected]>2025-05-12 13:54:55 +0200
committerEdvin <[email protected]>2025-05-12 13:54:55 +0200
commite7c40d60cd1208cee3e9813192deed3d7f8c431c (patch)
tree58a826af10aa06b3481ac3ca1861e027b70423af
parent88fe004e1347e6e299b3b8632c65d7fe30c03ebe (diff)
AGV will try to adjust always to get best rotation
-rwxr-xr-xmain.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/main.py b/main.py
index 47105d7..eb2b797 100755
--- a/main.py
+++ b/main.py
@@ -31,25 +31,25 @@ def calcCurDir(x, y, xo, yo):
def adjustAngle(adiff, f, b):
if f == True:
print("Going forward")
- if adiff < -10:
+ if adiff < 0:
print("Adjusting to the right")
NANO.write(b"Right\n")
sleep(abs(adiff) / 90)
NANO.write(b"Stop\n")
- elif adiff > 10:
+ elif adiff > 0:
print("Adjusting to the left")
NANO.write(b"Left\n")
sleep(abs(adiff) / 90)
NANO.write(b"Stop\n")
elif b == True:
print("Going backward")
- if adiff > 10:
+ if adiff > 0:
adiff -= 180
print(f"Adjusting to the right {adiff}")
NANO.write(b"Right\n")
sleep(abs(adiff) / 90)
NANO.write(b"Stop\n")
- elif adiff < -10:
+ elif adiff < 0:
adiff += 180
print(f"Adjusting to the left {adiff}")
NANO.write(b"Left\n")