pid steering
This commit is contained in:
parent
e6d26d4aa8
commit
97426742f7
|
|
@ -77,7 +77,6 @@ for chunk in stream.iter_content(chunk_size=1024):
|
||||||
cv2.circle(frame, center, radius, (255, 0, 0), 2)
|
cv2.circle(frame, center, radius, (255, 0, 0), 2)
|
||||||
cv2.circle(frame, center, 5, (0, 0, 255), -1)
|
cv2.circle(frame, center, 5, (0, 0, 255), -1)
|
||||||
|
|
||||||
|
|
||||||
if int(radius) >= 100:
|
if int(radius) >= 100:
|
||||||
motorL.stop()
|
motorL.stop()
|
||||||
motorR.stop()
|
motorR.stop()
|
||||||
|
|
@ -106,8 +105,8 @@ for chunk in stream.iter_content(chunk_size=1024):
|
||||||
|
|
||||||
k = wp * p + wi * i + wd * d
|
k = wp * p + wi * i + wd * d
|
||||||
|
|
||||||
motorL.start(-v * min(100 + k, 100))
|
motorL.start(max(0, -v * min(100 + k, 100)))
|
||||||
motorR.start(v * min(100 - k, 100))
|
motorR.start(max(0, v * min(100 - k, 100)))
|
||||||
xp = x
|
xp = x
|
||||||
ip = i
|
ip = i
|
||||||
|
|
||||||
|
|
@ -116,7 +115,7 @@ for chunk in stream.iter_content(chunk_size=1024):
|
||||||
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)
|
||||||
else:
|
else:
|
||||||
ip=0
|
ip = 0
|
||||||
# ============================
|
# ============================
|
||||||
# 👆 KONIEC DETEKCJI PIŁKI 👆
|
# 👆 KONIEC DETEKCJI PIŁKI 👆
|
||||||
# ============================
|
# ============================
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue