From b16559c4a0cefd14576b853616099da56c8687a0 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh <8762862+adeebshihadeh@users.noreply.github.com> Date: Mon, 15 Jun 2020 18:11:50 -0700 Subject: [PATCH] Block entry on non-adaptive cruise mode (#1708) * block entry on non-adaptive cruise mode * user disable * toyota old-commit-hash: 25688f36cc16f4a4ce57e2e6d7a5c33e78cd520f --- selfdrive/car/interfaces.py | 2 ++ selfdrive/car/toyota/carstate.py | 2 ++ selfdrive/controls/lib/events.py | 6 +++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/selfdrive/car/interfaces.py b/selfdrive/car/interfaces.py index db6b75319a..c73aa93847 100644 --- a/selfdrive/car/interfaces.py +++ b/selfdrive/car/interfaces.py @@ -107,6 +107,8 @@ class CarInterfaceBase(): events.add(EventName.stockAeb) if cs_out.vEgo > MAX_CTRL_SPEED: events.add(EventName.speedTooHigh) + if cs_out.cruiseState.nonAdaptive: + events.add(EventName.wrongCruiseMode) if cs_out.steerError: events.add(EventName.steerUnavailable) diff --git a/selfdrive/car/toyota/carstate.py b/selfdrive/car/toyota/carstate.py index 1c8c3735d7..02bd893eeb 100644 --- a/selfdrive/car/toyota/carstate.py +++ b/selfdrive/car/toyota/carstate.py @@ -90,6 +90,8 @@ class CarState(CarStateBase): else: ret.cruiseState.standstill = self.pcm_acc_status == 7 ret.cruiseState.enabled = bool(cp.vl["PCM_CRUISE"]['CRUISE_ACTIVE']) + # TODO: CRUISE_STATE is a 4 bit signal, find any other non-adaptive cruise states + ret.cruiseState.nonAdaptive = cp.vl["PCM_CRUISE"]['CRUISE_STATE'] in [5] if self.CP.carFingerprint == CAR.PRIUS: ret.genericToggle = cp.vl["AUTOPARK_STATUS"]['STATE'] != 0 diff --git a/selfdrive/controls/lib/events.py b/selfdrive/controls/lib/events.py index db36fe99ca..7d1895e038 100644 --- a/selfdrive/controls/lib/events.py +++ b/selfdrive/controls/lib/events.py @@ -189,7 +189,6 @@ EVENTS = { EventName.gasPressed: {ET.PRE_ENABLE: None}, - EventName.wrongCruiseMode: {}, EventName.laneChangeBlocked: {}, EventName.focusRecoverActive: {}, @@ -485,6 +484,11 @@ EVENTS = { duration_hud_alert=0.), }, + EventName.wrongCruiseMode: { + ET.USER_DISABLE: EngagementAlert(AudibleAlert.chimeDisengage), + ET.NO_ENTRY: NoEntryAlert("Enable Adaptive Cruise"), + }, + EventName.steerTempUnavailable: { ET.WARNING: Alert( "TAKE CONTROL",