From 8bb6c8fc1738a4367ceae141ef17d9e020b0b230 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Wed, 18 Sep 2024 08:22:13 -0400 Subject: [PATCH] some more infra --- selfdrive/controls/controlsd.py | 4 ++++ selfdrive/selfdrived/selfdrived.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index 80331c6ee7..7242288c61 100755 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -56,6 +56,9 @@ class Controls: elif self.CP.lateralTuning.which() == 'torque': self.LaC = LatControlTorque(self.CP, self.CI) + data_services = list(self.pm.sock.keys()) + ['selfdriveStateSP'] + self.sm = messaging.SubMaster(data_services, poll='selfdriveState') + def update(self): self.sm.update(15) if self.sm.updated["liveCalibration"]: @@ -89,6 +92,7 @@ class Controls: # Check which actuators can be enabled standstill = CS.vEgo <= max(self.CP.minSteerSpeed, MIN_LATERAL_CONTROL_SPEED) or CS.standstill CC.latActive = self.sm['selfdriveState'].active and not CS.steerFaultTemporary and not CS.steerFaultPermanent and not standstill + CC.latActive = CC.latActive or self.sm['selfdriveStateSP'].mads.enabled CC.longActive = CC.enabled and not any(e.overrideLongitudinal for e in self.sm['onroadEvents']) and self.CP.openpilotLongitudinalControl actuators = CC.actuators diff --git a/selfdrive/selfdrived/selfdrived.py b/selfdrive/selfdrived/selfdrived.py index ea4709add9..3b6271a884 100755 --- a/selfdrive/selfdrived/selfdrived.py +++ b/selfdrive/selfdrived/selfdrived.py @@ -128,7 +128,7 @@ class SelfdriveD: elif self.CP.passive: self.events.add(EventName.dashcamMode, static=True) - sock_services = [self.pm.sock.keys()] + ['selfdriveStateSP'] + sock_services = list(self.pm.sock.keys()) + ['selfdriveStateSP'] self.pm = messaging.PubMaster(sock_services) self.mads = ModifiedAssistDrivingSystem(self)