mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-01 03:22:07 +08:00
lagd: check for validity of the estimate when restoring state (#35034)
Do not restore if invalid
This commit is contained in:
@@ -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}")
|
||||
|
||||
Reference in New Issue
Block a user