From 72ccad5eae620f0413f8adc73fab4749abb4fc4a Mon Sep 17 00:00:00 2001 From: kegman Date: Wed, 12 Dec 2018 01:59:17 -0500 Subject: [PATCH] Proper alerts on Eon and disable flashing HUD alert when blinkers on or LKAS off (#63) * Disable steer alert when LKAS off * Display steering unavailable on Eon when LKAS off * Revert chime disable in favor of new method * x_lead < 6 or (x_lead < 17.5 and self.v_rel < 0.5) * logic correction on HUD alert * blinkers on disables HUD alarm * Add Manual Steering alert for LKAS Off mode * Call manual steering alert when LKAS off * Call blinkers alert when blinkers on * Add blinkers alert * Adjust Blinkers alert logic to include LKAS mode * Fix blinker logic * Add new steering required alerts to capnp * Trace LKAS / LDW error * Disable hud alert when LKAS off or blinkers on * Disable HUD alerts if LKAS off or blinkers on * Disable other ACC alert if LKAS off or blinkers on * Revert testing of steering required alert override * Disable steer saturate alert if blinkers on or LKAS off * Disable steer sat alert if LKAS off or blinkers on * Revert steerSaturated logic * disable steer limit alert when LKAS off or blinkers on * Fix Syntax error * Revert steerLimit alert disable * Disable steerSat alert when blinkers on or LKAS off * Revert stopping distance to default for pedal lurch * Re-intro 2m stopping distance --- cereal/car.capnp | 2 ++ selfdrive/car/honda/carcontroller.py | 7 ++++--- selfdrive/car/honda/interface.py | 6 +++++- selfdrive/controls/controlsd.py | 2 +- selfdrive/controls/lib/alerts.py | 14 ++++++++++++++ 5 files changed, 26 insertions(+), 5 deletions(-) diff --git a/cereal/car.capnp b/cereal/car.capnp index 5300c83f86fd3c..9a5d0198e45089 100644 --- a/cereal/car.capnp +++ b/cereal/car.capnp @@ -72,6 +72,8 @@ struct CarEvent @0x9b1657f34caf3ad3 { calibrationProgress @47; lowBattery @48; invalidGiraffeHonda @49; + manualSteeringRequired @50; + manualSteeringRequiredBlinkersOn @51; } } diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 7863242dd11b0c..2bfaf85ff0a5c4 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -56,6 +56,7 @@ def process_hud_alert(hud_alert): fcw_display = 0 steer_required = 0 acc_alert = 0 + if hud_alert == AH.NONE: # no alert pass elif hud_alert == AH.FCW: # FCW @@ -64,7 +65,7 @@ def process_hud_alert(hud_alert): steer_required = hud_alert[1] else: # any other ACC alert acc_alert = hud_alert[1] - + return fcw_display, steer_required, acc_alert @@ -124,8 +125,8 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ snd_beep = snd_beep if snd_beep is not 0 else snd_chime # Do not send audible alert when steering is disabled or blinkers on - if not CS.lkMode or CS.left_blinker_on or CS.right_blinker_on: - snd_chime = 0 + #if not CS.lkMode or CS.left_blinker_on or CS.right_blinker_on: + # snd_chime = 0 #print chime, alert_id, hud_alert fcw_display, steer_required, acc_alert = process_hud_alert(hud_alert) diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index f6e27d3586a25a..818364941ef683 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -510,7 +510,11 @@ def update(self, c): else: self.cam_can_invalid_count = 0 - if self.CS.steer_error: + if not self.CS.lkMode: + events.append(create_event('manualSteeringRequired', [ET.WARNING])) + elif self.CS.lkMode and (self.CS.left_blinker_on or self.CS.right_blinker_on): + events.append(create_event('manualSteeringRequiredBlinkersOn', [ET.WARNING])) + elif self.CS.steer_error: events.append(create_event('steerUnavailable', [ET.NO_ENTRY, ET.IMMEDIATE_DISABLE, ET.PERMANENT])) elif self.CS.steer_warning: events.append(create_event('steerTempUnavailable', [ET.WARNING])) diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index b253c75d3772f6..cdc870feb2ebbe 100755 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -278,7 +278,7 @@ def state_control(plan, CS, CP, state, events, v_cruise_kph, v_cruise_kph_last, CS.steeringPressed, plan.dPoly, angle_offset, CP, VM, PL) # Send a "steering required alert" if saturation count has reached the limit - if LaC.sat_flag and CP.steerLimitAlert: + if LaC.sat_flag and CP.steerLimitAlert and CS.lkMode and not CS.leftBlinker and not CS.rightBlinker: AM.add("steerSaturated", enabled) # Parse permanent warnings to display constantly diff --git a/selfdrive/controls/lib/alerts.py b/selfdrive/controls/lib/alerts.py index cc9b19d5d4fa70..fb3473a4a62f1c 100644 --- a/selfdrive/controls/lib/alerts.py +++ b/selfdrive/controls/lib/alerts.py @@ -100,6 +100,20 @@ def __gt__(self, alert2): "Steering Temporarily Unavailable", AlertStatus.userPrompt, AlertSize.mid, Priority.LOW, VisualAlert.none, AudibleAlert.none, .2, .2, .2), + + Alert( + "manualSteeringRequired", + "MANUAL STEERING REQUIRED", + "Steering is Off - Press LKAS button to turn On", + AlertStatus.userPrompt, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.none, .2, .2, .2), + + Alert( + "manualSteeringRequiredBlinkersOn", + "MANUAL STEERING REQUIRED", + "Left or Right Signal is On", + AlertStatus.userPrompt, AlertSize.mid, + Priority.LOW, VisualAlert.none, AudibleAlert.none, .2, .2, .2), Alert( "preDriverDistracted",