From 5d47ffdb8ab2bbc6a842dd346fdeb8e9b13c737f Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Thu, 23 Oct 2025 03:48:04 -0400 Subject: [PATCH] Speed Limit Assist: Disable for Rivian (#1421) * Speed Limit Assist: Disable for Tesla in release * add test * unused * use constant * eh * flip * universal it * check release state and align in tests * use this * eh * update changelog * Speed Limit Assist: Disable for Rivian * desc * changelog --- CHANGELOG.md | 2 +- .../longitudinal/speed_limit/speed_limit_settings.cc | 6 ++++-- sunnypilot/selfdrive/controls/lib/speed_limit/helpers.py | 3 ++- .../lib/speed_limit/tests/test_speed_limit_assist.py | 6 ++++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 66f5f432b1..5b79d67826 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,7 @@ sunnypilot Version 2025.001.000 (2025-10-25) * Intelligent longitudinal control adaptation * Speed Limit Assist (SLA) * Comprehensive speed limit integration featuring @pfeiferj's `mapd` for offline map limits downloads, a Speed Limit Resolver for sourcing data (from car, map, combined, etc), on-screen UI for Speed Limit Information/Warning, and Speed Limit Assist (SLA) to adjust cruise speed automatically. - * Currently disabled for Tesla with sunnypilot Longitudinal Control in release + * Currently disabled for Tesla with sunnypilot Longitudinal Control in release and Rivian with sunnypilot Longitudinal Control in all branches * May return in future releases * Intelligent Cruise Button Management (ICBM) * System designed to manage the vehicle’s speed by sending cruise control button commands to the car’s ECU. diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/longitudinal/speed_limit/speed_limit_settings.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/longitudinal/speed_limit/speed_limit_settings.cc index 8724e68651..99c227d233 100644 --- a/selfdrive/ui/sunnypilot/qt/offroad/settings/longitudinal/speed_limit/speed_limit_settings.cc +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/longitudinal/speed_limit/speed_limit_settings.cc @@ -128,10 +128,12 @@ void SpeedLimitSettings::refresh() { /* * Speed Limit Assist is available when: * - has_longitudinal_control or has_icbm, and - * - is not a release branch or not a disallowed brand + * - is not a release branch or not a disallowed brand, and + * - is not always disallowed */ bool sla_disallow_in_release = CP.getBrand() == "tesla" && is_release; - sla_available = (has_longitudinal_control || has_icbm) && !sla_disallow_in_release; + bool sla_always_disallow = CP.getBrand() == "rivian"; + sla_available = (has_longitudinal_control || has_icbm) && !sla_disallow_in_release && !sla_always_disallow; if (!sla_available && speed_limit_mode_param == SpeedLimitMode::ASSIST) { params.put("SpeedLimitMode", std::to_string(static_cast(SpeedLimitMode::WARNING))); diff --git a/sunnypilot/selfdrive/controls/lib/speed_limit/helpers.py b/sunnypilot/selfdrive/controls/lib/speed_limit/helpers.py index 04a85f57c4..4f388befc7 100644 --- a/sunnypilot/selfdrive/controls/lib/speed_limit/helpers.py +++ b/sunnypilot/selfdrive/controls/lib/speed_limit/helpers.py @@ -28,9 +28,10 @@ def set_speed_limit_assist_availability(CP: car.CarParams, CP_SP: custom.CarPara is_release = params.get_bool("IsReleaseSpBranch") disallow_in_release = CP.brand == "tesla" and is_release + always_disallow = CP.brand == "rivian" allowed = True - if disallow_in_release: + if disallow_in_release or always_disallow: allowed = False if not CP.openpilotLongitudinalControl and CP_SP.pcmCruiseSpeed: diff --git a/sunnypilot/selfdrive/controls/lib/speed_limit/tests/test_speed_limit_assist.py b/sunnypilot/selfdrive/controls/lib/speed_limit/tests/test_speed_limit_assist.py index 5dc89cfd80..aa6650adda 100644 --- a/sunnypilot/selfdrive/controls/lib/speed_limit/tests/test_speed_limit_assist.py +++ b/sunnypilot/selfdrive/controls/lib/speed_limit/tests/test_speed_limit_assist.py @@ -9,6 +9,7 @@ import pytest from cereal import custom from opendbc.car.car_helpers import interfaces +from opendbc.car.rivian.values import CAR as RIVIAN from opendbc.car.tesla.values import CAR as TESLA from opendbc.car.toyota.values import CAR as TOYOTA from openpilot.common.constants import CV @@ -104,11 +105,12 @@ class TestSpeedLimitAssist: assert not self.sla.is_active assert V_CRUISE_UNSET == self.sla.get_v_target_from_control() - @pytest.mark.parametrize("car_name", [TESLA.TESLA_MODEL_Y], indirect=True) + @pytest.mark.parametrize("car_name", [RIVIAN.RIVIAN_R1_GEN1, TESLA.TESLA_MODEL_Y], indirect=True) def test_disallowed_brands(self, car_name): """ Speed Limit Assist is disabled for the following brands and conditions: - - All Tesla and is a release branch + - All Tesla and is a release branch; + - All Rivian """ assert not self.sla.enabled