From 3e3b8751113c1bda96776eccf8b17ca57f8379dc Mon Sep 17 00:00:00 2001 From: Mitchell Goff Date: Wed, 20 Oct 2021 07:16:40 -0700 Subject: [PATCH] Only trigger model FCW on stock long when not already braking (#22620) * Only trigger model FCW on stock long when not already braking * Split model_fcw checks for better readability old-commit-hash: 38f775edfc12736f590885705c3a92a785d531f8 --- selfdrive/controls/controlsd.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index 06970498d7..a10f1b26d1 100755 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -282,8 +282,10 @@ class Controls: for pandaState in self.sm['pandaStates']: if log.PandaState.FaultType.relayMalfunction in pandaState.faults: self.events.add(EventName.relayMalfunction) + + stock_long_is_braking = self.enabled and not self.CP.openpilotLongitudinalControl and CS.aEgo < -1.5 + model_fcw = self.sm['modelV2'].meta.hardBrakePredicted and not CS.brakePressed and not stock_long_is_braking planner_fcw = self.sm['longitudinalPlan'].fcw and self.enabled - model_fcw = self.sm['modelV2'].meta.hardBrakePredicted and not CS.brakePressed if planner_fcw or model_fcw: self.events.add(EventName.fcw)