diff options
| author | Edvin <[email protected]> | 2025-05-12 13:54:55 +0200 |
|---|---|---|
| committer | Edvin <[email protected]> | 2025-05-12 13:54:55 +0200 |
| commit | e7c40d60cd1208cee3e9813192deed3d7f8c431c (patch) | |
| tree | 58a826af10aa06b3481ac3ca1861e027b70423af | |
| parent | 88fe004e1347e6e299b3b8632c65d7fe30c03ebe (diff) | |
AGV will try to adjust always to get best rotation
| -rwxr-xr-x | main.py | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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") |
