From b3e1ecfa85c3d8e7de9059b8b8cbbbc1a0614586 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Thu, 12 Dec 2024 23:24:52 -0500 Subject: [PATCH] only force exit if actually actuating --- selfdrive/pandad/pandad.cc | 2 +- sunnypilot/mads/mads.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/selfdrive/pandad/pandad.cc b/selfdrive/pandad/pandad.cc index f4cdd84b9a..2abd4fbfff 100644 --- a/selfdrive/pandad/pandad.cc +++ b/selfdrive/pandad/pandad.cc @@ -367,7 +367,7 @@ void process_panda_state(std::vector &pandas, PubMaster *pm, bool spoof sm.update(0); const bool engaged = sm.allAliveAndValid({"selfdriveState"}) && sm["selfdriveState"].getSelfdriveState().getEnabled(); - const bool engaged_mads = sm.allAliveAndValid({"selfdriveStateSP"}) && sm["selfdriveStateSP"].getSelfdriveStateSP().getMads().getEnabled(); + const bool engaged_mads = sm.allAliveAndValid({"selfdriveStateSP"}) && sm["selfdriveStateSP"].getSelfdriveStateSP().getMads().getActive(); for (const auto &panda : pandas) { panda->send_heartbeat(engaged, engaged_mads); } diff --git a/sunnypilot/mads/mads.py b/sunnypilot/mads/mads.py index 871d0203a3..0477e1c59c 100644 --- a/sunnypilot/mads/mads.py +++ b/sunnypilot/mads/mads.py @@ -140,10 +140,10 @@ class ModularAssistiveDrivingSystem: self.events.add(EventName.controlsMismatchLateral) def data_sample(self, sm: messaging.SubMaster): - if not self.enabled: + if not self.active: self.mismatch_counter = 0 - if self.enabled and any(not ps.controlsAllowedLat for ps in sm['pandaStates'] + if self.active and any(not ps.controlsAllowedLat for ps in sm['pandaStates'] if ps.safetyModel not in IGNORED_SAFETY_MODES): self.mismatch_counter += 1