fix: 修复 calibrate_new 方法中超过20次未找到处理的问题

This commit is contained in:
bmy
2024-06-17 17:21:36 +08:00
parent 1ac91b678b
commit e72f1e5c24

View File

@@ -118,7 +118,9 @@ def calibrate_new(label, offset, run = True, run_speed = 3.5):
break
ret, box = filter.get(label)
error = (box[0][2] + box[0][0] - 320) / 2 + offset
# 如果超过二十帧跳出,则此时 box 为空值,需要再校验 ret
if ret is True:
error = (box[0][2] + box[0][0] - 320) / 2 + offset
if abs(error) > 10 and run:
if error > 0:
by_cmd.send_speed_x(-run_speed)