Block entry on non-adaptive cruise mode (#1708)

* block entry on non-adaptive cruise mode

* user disable

* toyota
old-commit-hash: 25688f36cc
commatwo_master
Adeeb Shihadeh 5 years ago committed by GitHub
parent e7a7bf0898
commit b16559c4a0
  1. 2
      selfdrive/car/interfaces.py
  2. 2
      selfdrive/car/toyota/carstate.py
  3. 6
      selfdrive/controls/lib/events.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)

@ -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

@ -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",

Loading…
Cancel
Save