From f645e2cdb001bf8c93833285d4792cac1647a864 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Sun, 12 Jan 2025 17:12:31 -0500 Subject: [PATCH] check live param --- sunnypilot/selfdrive/controls/lib/dec/dec.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sunnypilot/selfdrive/controls/lib/dec/dec.py b/sunnypilot/selfdrive/controls/lib/dec/dec.py index eff8fc804a..3760d56860 100644 --- a/sunnypilot/selfdrive/controls/lib/dec/dec.py +++ b/sunnypilot/selfdrive/controls/lib/dec/dec.py @@ -25,6 +25,7 @@ import numpy as np from openpilot.common.numpy_fast import interp from openpilot.common.params import Params +from openpilot.common.realtime import DT_MDL # d-e2e, from modeldata.h TRAJECTORY_SIZE = 33 @@ -367,11 +368,17 @@ class DynamicExperimentalController: if self._set_mode_timeout > 0: self._set_mode_timeout -= 1 + def _read_params(self, sm): + if sm.frame % int(1. / DT_MDL) == 0: + self._is_enabled = self._params.get_bool("DynamicExperimentalControl") + def update(self, radar_unavailable, sm): car_state = sm['carState'] lead_one = sm['radarState'].leadOne md = sm['modelV2'] + self._read_params(sm) + if self._is_enabled: self._update(car_state, lead_one, md)