From 8fae7b4de9acf985ed7572f55f72d97b9decf430 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh <adeebshihadeh@gmail.com> Date: Sat, 2 Dec 2023 22:15:48 -0800 Subject: [PATCH] SubMaster: add ignore_valid arg --- messaging/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/messaging/__init__.py b/messaging/__init__.py index 139f9d3c1..1348bf0b9 100644 --- a/messaging/__init__.py +++ b/messaging/__init__.py @@ -153,7 +153,7 @@ def recv_one_retry(sock: SubSocket) -> capnp.lib.capnp._DynamicStructReader: class SubMaster: def __init__(self, services: List[str], poll: Optional[List[str]] = None, ignore_alive: Optional[List[str]] = None, ignore_avg_freq: Optional[List[str]] = None, - addr: str = "127.0.0.1"): + ignore_valid: Optional[List[str]] = None, addr: str = "127.0.0.1"): self.frame = -1 self.updated = {s: False for s in services} self.rcv_time = {s: 0. for s in services} @@ -173,6 +173,7 @@ def __init__(self, services: List[str], poll: Optional[List[str]] = None, self.ignore_average_freq = [] if ignore_avg_freq is None else ignore_avg_freq self.ignore_alive = [] if ignore_alive is None else ignore_alive + self.ignore_valid = [] if ignore_valid is None else ignore_valid self.simulation = bool(int(os.getenv("SIMULATION", "0"))) for s in services: @@ -265,7 +266,7 @@ def all_freq_ok(self, service_list=None) -> bool: def all_valid(self, service_list=None) -> bool: if service_list is None: # check all service_list = self.valid.keys() - return all(self.valid[s] for s in service_list) + return all(self.valid[s] for s in service_list if s not in self.ignore_valid) def all_checks(self, service_list=None) -> bool: if service_list is None: # check all