From db7ea2a5997876d368cc64defb47938b4583c055 Mon Sep 17 00:00:00 2001 From: Adeeb <8762862+adeebshihadeh@users.noreply.github.com> Date: Tue, 2 Jun 2020 18:40:39 -0700 Subject: [PATCH] fix speed too low (#1628) --- cereal/car.capnp | 1 + selfdrive/car/gm/interface.py | 2 +- selfdrive/car/honda/interface.py | 4 ++-- selfdrive/car/mazda/interface.py | 2 +- selfdrive/car/toyota/interface.py | 2 +- selfdrive/controls/lib/events.py | 5 ++++- 6 files changed, 10 insertions(+), 6 deletions(-) diff --git a/cereal/car.capnp b/cereal/car.capnp index c4be41b0737001..05c2dd6d295592 100644 --- a/cereal/car.capnp +++ b/cereal/car.capnp @@ -106,6 +106,7 @@ struct CarEvent @0x9b1657f34caf3ad3 { whitePandaUnsupported @81; startupWhitePanda @82; canErrorPersistent @83; + belowEngageSpeed @84; } } diff --git a/selfdrive/car/gm/interface.py b/selfdrive/car/gm/interface.py index 18baf8886df2c1..d74e6f669e40c0 100755 --- a/selfdrive/car/gm/interface.py +++ b/selfdrive/car/gm/interface.py @@ -149,7 +149,7 @@ def update(self, c, can_strings): events = self.create_common_events(ret, pcm_enable=False) if ret.vEgo < self.CP.minEnableSpeed: - events.add(EventName.speedTooLow) + events.add(EventName.belowEngageSpeed) if self.CS.park_brake: events.add(EventName.parkBrake) if ret.cruiseState.standstill: diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index 4c566b38194228..f4005725b73087 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -476,12 +476,12 @@ def update(self, c, can_strings): events.add(EventName.parkBrake) if self.CP.enableCruise and ret.vEgo < self.CP.minEnableSpeed: - events.add(EventName.speedTooLow) + events.add(EventName.belowEngageSpeed) # it can happen that car cruise disables while comma system is enabled: need to # keep braking if needed or if the speed is very low if self.CP.enableCruise and not ret.cruiseState.enabled \ - and (c.actuators.brake <= 0. or not self.CP.openpilotLongitudinalControl) and (self.CP.minEnableSpeed > 0): + and (c.actuators.brake <= 0. or not self.CP.openpilotLongitudinalControl): # non loud alert if cruise disables below 25mph as expected (+ a little margin) if ret.vEgo < self.CP.minEnableSpeed + 2.: events.add(EventName.speedTooLow) diff --git a/selfdrive/car/mazda/interface.py b/selfdrive/car/mazda/interface.py index 68f7b19ac3f34c..87e131238afceb 100755 --- a/selfdrive/car/mazda/interface.py +++ b/selfdrive/car/mazda/interface.py @@ -78,7 +78,7 @@ def update(self, c, can_strings): events = self.create_common_events(ret) if self.CS.low_speed_lockout: - events.add(EventName.speedTooLow) + events.add(EventName.belowEngageSpeed) if self.CS.low_speed_alert: events.add(EventName.belowSteerSpeed) diff --git a/selfdrive/car/toyota/interface.py b/selfdrive/car/toyota/interface.py index 89149b6ae48fe1..a0feda241472bb 100755 --- a/selfdrive/car/toyota/interface.py +++ b/selfdrive/car/toyota/interface.py @@ -323,7 +323,7 @@ def update(self, c, can_strings): if self.CS.low_speed_lockout and self.CP.openpilotLongitudinalControl: events.add(EventName.lowSpeedLockout) if ret.vEgo < self.CP.minEnableSpeed and self.CP.openpilotLongitudinalControl: - events.add(EventName.speedTooLow) + events.add(EventName.belowEngageSpeed) if c.actuators.gas > 0.1: # some margin on the actuator to not false trigger cancellation while stopping events.add(EventName.speedTooLow) diff --git a/selfdrive/controls/lib/events.py b/selfdrive/controls/lib/events.py index 2b21cd71712356..6bd865a974bd55 100644 --- a/selfdrive/controls/lib/events.py +++ b/selfdrive/controls/lib/events.py @@ -503,6 +503,10 @@ def calibration_incomplete_alert(CP, sm, metric): duration_hud_alert=0.), }, + EventName.belowEngageSpeed: { + ET.NO_ENTRY: NoEntryAlert("Speed Too Low"), + }, + EventName.sensorDataInvalid: { ET.PERMANENT: Alert( "No Data from Device Sensors", @@ -677,7 +681,6 @@ def calibration_incomplete_alert(CP, sm, metric): "Speed too low", AlertStatus.normal, AlertSize.mid, Priority.HIGH, VisualAlert.none, AudibleAlert.chimeDisengage, .4, 2., 3.), - ET.NO_ENTRY: NoEntryAlert("Speed Too Low"), }, EventName.speedTooHigh: {