From 341d27f666a92bd4baf2b31116dd60d3fbf36091 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20R=C4=85czy?= Date: Thu, 27 Mar 2025 16:26:16 -0700 Subject: [PATCH] Fix --- selfdrive/locationd/lagd.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/selfdrive/locationd/lagd.py b/selfdrive/locationd/lagd.py index 6aab383fcf..51d0e83cdf 100755 --- a/selfdrive/locationd/lagd.py +++ b/selfdrive/locationd/lagd.py @@ -246,9 +246,10 @@ class LagEstimator: times, desired, actual, okay = self.points.get() # check if there are any new valid data points since the last update - new_values_start_idx = next(-i for i, t in enumerate(reversed(times)) if t <= self.last_estimate_t) - if self.last_estimate_t != 0 and (new_values_start_idx == 0 or not np.any(okay[new_values_start_idx:])): - return + if self.last_estimate_t != 0: + new_values_start_idx = next(-i for i, t in enumerate(reversed(times)) if t <= self.last_estimate_t) + if (new_values_start_idx == 0 or not np.any(okay[new_values_start_idx:])): + return delay, corr = self.actuator_delay(desired, actual, okay, self.dt) if corr < self.min_ncc: