From e72f1e5c2413fa0aeb9211937bcb6d2f024361d1 Mon Sep 17 00:00:00 2001 From: bmy <2583236812@qq.com> Date: Mon, 17 Jun 2024 17:21:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20calibrate=5Fnew=20?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E4=B8=AD=E8=B6=85=E8=BF=8720=E6=AC=A1?= =?UTF-8?q?=E6=9C=AA=E6=89=BE=E5=88=B0=E5=A4=84=E7=90=86=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- subtask.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/subtask.py b/subtask.py index d17cdd4..ed1a8ab 100644 --- a/subtask.py +++ b/subtask.py @@ -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)