From d1dee4625a9f47cdfa0a379f63daf652eb6b7e1f Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Tue, 29 Nov 2022 17:34:10 -0800 Subject: [PATCH] controlsd: preEnable on brake at a standstill (#26273) * pre-enable on brake at standstill * test by getting rid of noTarget * Update events.py * rename * stash what we got so far * cmt * not sure if best way to fix, but enabled with current states defs is fine * no noEntry in preEnabled * bumpcereal * uncomment * Update ref_commit Co-authored-by: Adeeb Shihadeh old-commit-hash: dbe512d167a51f02fe276e17a8794de2137d0e14 --- cereal | 2 +- selfdrive/controls/controlsd.py | 5 ++++- selfdrive/controls/lib/events.py | 4 ++-- selfdrive/test/process_replay/ref_commit | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/cereal b/cereal index 3bae09cf65..7f55399fde 160000 --- a/cereal +++ b/cereal @@ -1 +1 @@ -Subproject commit 3bae09cf6527674d7eda3a9956242aad94a8f3d2 +Subproject commit 7f55399fde0b6a70c1bf7df4f86b90b0060e31ac diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index d99357fbb6..e5c981aa6b 100755 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -249,6 +249,9 @@ class Controls: (CS.regenBraking and (not self.CS_prev.regenBraking or not CS.standstill)): self.events.add(EventName.pedalPressed) + if CS.brakePressed and CS.standstill: + self.events.add(EventName.preEnableStandstill) + if CS.gasPressed: self.events.add(EventName.gasPressedOverride) @@ -579,7 +582,7 @@ class Controls: # Check which actuators can be enabled CC.latActive = self.active and not CS.steerFaultTemporary and not CS.steerFaultPermanent and \ CS.vEgo > self.CP.minSteerSpeed and not CS.standstill - CC.longActive = self.active and not self.events.any(ET.OVERRIDE_LONGITUDINAL) and self.CP.openpilotLongitudinalControl + CC.longActive = self.enabled and not self.events.any(ET.OVERRIDE_LONGITUDINAL) and self.CP.openpilotLongitudinalControl actuators = CC.actuators actuators.longControlState = self.LoC.long_control_state diff --git a/selfdrive/controls/lib/events.py b/selfdrive/controls/lib/events.py index ad10b8f0bd..5d5000ff54 100644 --- a/selfdrive/controls/lib/events.py +++ b/selfdrive/controls/lib/events.py @@ -615,9 +615,9 @@ EVENTS: Dict[int, Dict[str, Union[Alert, AlertCallbackType]]] = { visual_alert=VisualAlert.brakePressed), }, - EventName.pedalPressedPreEnable: { + EventName.preEnableStandstill: { ET.PRE_ENABLE: Alert( - "Release Pedal to Engage", + "Release Brake to Engage", "", AlertStatus.normal, AlertSize.small, Priority.LOWEST, VisualAlert.none, AudibleAlert.none, .1, creation_delay=1.), diff --git a/selfdrive/test/process_replay/ref_commit b/selfdrive/test/process_replay/ref_commit index 71da0dff44..4641299458 100644 --- a/selfdrive/test/process_replay/ref_commit +++ b/selfdrive/test/process_replay/ref_commit @@ -1 +1 @@ -ddfaab44ae64a0d064b847e81080993b51b6b423 \ No newline at end of file +f17412941a0e8229eea308c33189a5bdb1a17ae8