pid steering

This commit is contained in:
tymek 2025-08-01 19:06:09 +02:00
parent 64702e6bac
commit c8797cb5bc

View file

@ -107,6 +107,7 @@ for chunk in stream.iter_content(chunk_size=1024):
speedL = max(-99, -v * min(100 + k, 99)) speedL = max(-99, -v * min(100 + k, 99))
speedR = max(-99, v * min(100 - k, 99)) speedR = max(-99, v * min(100 - k, 99))
print(p, d, i, speedL, speedR)
motorL.start(int(speedL)) motorL.start(int(speedL))
motorR.start(int(speedR)) motorR.start(int(speedR))
xp = x xp = x
@ -116,7 +117,6 @@ for chunk in stream.iter_content(chunk_size=1024):
cv2.putText(frame, f"P:{int(p)} D:{int(d)} I:{int(i)}", (10, 30), cv2.putText(frame, f"P:{int(p)} D:{int(d)} I:{int(i)}", (10, 30),
cv2.FONT_HERSHEY_SIMPLEX, 0.6, (0, 255, 0), 2) cv2.FONT_HERSHEY_SIMPLEX, 0.6, (0, 255, 0), 2)
#print("PDI: ", p, d, dtms, i) #print("PDI: ", p, d, dtms, i)
print(p, d, i, speedL, speedR)
else: else:
ip = 0 ip = 0
# ============================ # ============================