lagd: check for validity of the estimate when restoring state (#35034)

Do not restore if invalid
enable-online-lag
Kacper Rączy 1 week ago committed by GitHub
parent b42ec33a63
commit 15326c2d30
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      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}")

Loading…
Cancel
Save