From 0b5f21e468cae5faf4f18d193a71fdbf409703b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20R=C4=85czy?= Date: Wed, 12 Feb 2025 17:06:35 -0800 Subject: [PATCH] Report isEstimated --- cereal/log.capnp | 1 + selfdrive/locationd/lagd.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/cereal/log.capnp b/cereal/log.capnp index 8ca815a791..7a8871ffdf 100644 --- a/cereal/log.capnp +++ b/cereal/log.capnp @@ -2267,6 +2267,7 @@ struct LiveDelayData { steerActuatorDelay @0 :Float32; totalPoints @1 :Int32; points @2 :List(List(Float32)); + isEstimated @3 :Bool; } struct LiveMapDataDEPRECATED { diff --git a/selfdrive/locationd/lagd.py b/selfdrive/locationd/lagd.py index 9cd7e93335..f1042ccec2 100644 --- a/selfdrive/locationd/lagd.py +++ b/selfdrive/locationd/lagd.py @@ -71,10 +71,13 @@ class LagEstimator(ParameterEstimator): # FIXME: this is fragile and ugly, refactor this if len(self.lags) > 0: steer_actuation_delay = float(np.mean(self.lags)) + is_estimated = True else: steer_actuation_delay = self.initial_lag + is_estimated = False else: steer_actuation_delay = self.initial_lag + is_estimated = False msg = messaging.new_message('liveActuatorDelay') msg.valid = valid @@ -82,6 +85,7 @@ class LagEstimator(ParameterEstimator): liveActuatorDelay = msg.liveActuatorDelay liveActuatorDelay.steerActuatorDelay = steer_actuation_delay liveActuatorDelay.totalPoints = len(self.curvature) + liveActuatorDelay.isEstimated = is_estimated if with_points: liveActuatorDelay.points = [[c, dc] for ((_, c), (_, dc)) in zip(self.curvature, self.desired_curvature)]