From 85005b09a211f41a12c692a182d30f23b8d019bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20R=C4=85czy?= Date: Thu, 17 Apr 2025 18:23:40 -0700 Subject: [PATCH] Do not restore if invalid --- selfdrive/locationd/lagd.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/selfdrive/locationd/lagd.py b/selfdrive/locationd/lagd.py index 0a7c71a7ea..f4f46b7469 100755 --- a/selfdrive/locationd/lagd.py +++ b/selfdrive/locationd/lagd.py @@ -327,8 +327,9 @@ def retrieve_initial_lag(params_reader: Params, CP: car.CarParams): if last_CP.carFingerprint != CP.carFingerprint: raise Exception("Car model mismatch") - lag, valid_blocks = ld.lateralDelayEstimate, ld.validBlocks + lag, valid_blocks, status = ld.lateralDelayEstimate, ld.validBlocks, ld.status assert valid_blocks <= BLOCK_NUM, "Invalid number of valid blocks" + assert status != log.LiveDelayData.Status.invalid, "Lag estimate is invalid" return lag, valid_blocks except Exception as e: cloudlog.error(f"Failed to retrieve initial lag: {e}")