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)