From 65431f4e2f0a6835fa2f4a2a9d2dc5a0ce227e74 Mon Sep 17 00:00:00 2001 From: Kumar <36933347+rav4kumar@users.noreply.github.com> Date: Fri, 18 Apr 2025 11:02:50 -0700 Subject: [PATCH] DEC: adjust dynamic speed adaptation parameters (#813) * early and better * Update sunnypilot/selfdrive/controls/lib/dec/constants.py --------- Co-authored-by: Jason Wen Co-authored-by: Discountchubbs <159560811+Discountchubbs@users.noreply.github.com> --- sunnypilot/selfdrive/controls/lib/dec/constants.py | 5 ++--- sunnypilot/selfdrive/controls/lib/dec/dec.py | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/sunnypilot/selfdrive/controls/lib/dec/constants.py b/sunnypilot/selfdrive/controls/lib/dec/constants.py index c1e3726606..48f4203e93 100644 --- a/sunnypilot/selfdrive/controls/lib/dec/constants.py +++ b/sunnypilot/selfdrive/controls/lib/dec/constants.py @@ -2,12 +2,11 @@ class WMACConstants: LEAD_WINDOW_SIZE = 5 LEAD_PROB = 0.5 - SLOW_DOWN_WINDOW_SIZE = 4 + SLOW_DOWN_WINDOW_SIZE = 5 SLOW_DOWN_PROB = 0.6 SLOW_DOWN_BP = [0., 10., 20., 30., 40., 50., 55., 60.] - #SLOW_DOWN_DIST = [25., 38., 55., 75., 95., 115., 130., 150.] - SLOW_DOWN_DIST = [30., 45., 60., 80., 100., 120., 135., 150.] + SLOW_DOWN_DIST = [25., 38., 55., 75., 95., 115., 130., 150.] SLOWNESS_WINDOW_SIZE = 12 SLOWNESS_PROB = 0.5 diff --git a/sunnypilot/selfdrive/controls/lib/dec/dec.py b/sunnypilot/selfdrive/controls/lib/dec/dec.py index 0c33da500a..812e5cc15f 100644 --- a/sunnypilot/selfdrive/controls/lib/dec/dec.py +++ b/sunnypilot/selfdrive/controls/lib/dec/dec.py @@ -164,7 +164,7 @@ class DynamicExperimentalController: """ Adapts the slow-down threshold based on vehicle speed and recent behavior. """ - slowdown_scaling_factor: float = (1.0 + 0.05 * np.log(1 + len(self._slow_down_gmac.data))) + slowdown_scaling_factor: float = (1.0 + 0.03 * np.log(1 + len(self._slow_down_gmac.data))) adaptive_threshold: float = float( interp(self._v_ego_kph, WMACConstants.SLOW_DOWN_BP, WMACConstants.SLOW_DOWN_DIST) * slowdown_scaling_factor )