From 57f21abb4fe3ae81842adc07fb79a1d2c056fee0 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Fri, 7 Jun 2024 23:58:14 -0700 Subject: [PATCH] pandad: fix loopback test (#32656) * pandad: fix loopback test * clear all params * try this --------- Co-authored-by: Comma Device --- selfdrive/pandad/tests/test_pandad_loopback.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/selfdrive/pandad/tests/test_pandad_loopback.py b/selfdrive/pandad/tests/test_pandad_loopback.py index 365bb7611bb9bc..d2b6d047d562b8 100644 --- a/selfdrive/pandad/tests/test_pandad_loopback.py +++ b/selfdrive/pandad/tests/test_pandad_loopback.py @@ -20,10 +20,11 @@ @retry(attempts=3) def setup_pandad(num_pandas): params = Params() + params.clear_all() params.put_bool("IsOnroad", False) + sm = messaging.SubMaster(['pandaStates']) with Timeout(90, "pandad didn't start"): - sm = messaging.SubMaster(['pandaStates']) while sm.recv_frame['pandaStates'] < 1 or len(sm['pandaStates']) == 0 or \ any(ps.pandaType == log.PandaState.PandaType.unknown for ps in sm['pandaStates']): sm.update(1000) @@ -44,6 +45,9 @@ def setup_pandad(num_pandas): params.put_bool("ControlsReady", True) params.put("CarParams", cp.to_bytes()) + with Timeout(90, "pandad didn't set safety mode"): + while any(ps.safetyModel != car.CarParams.SafetyModel.allOutput for ps in sm['pandaStates']): + sm.update(1000) def send_random_can_messages(sendcan, count, num_pandas=1): sent_msgs = defaultdict(set) @@ -73,10 +77,11 @@ def setup_class(cls): def test_loopback(self): num_pandas = 2 if TICI and "SINGLE_PANDA" not in os.environ else 1 setup_pandad(num_pandas) + sendcan = messaging.pub_sock('sendcan') can = messaging.sub_sock('can', conflate=False, timeout=100) sm = messaging.SubMaster(['pandaStates']) - time.sleep(0.5) + time.sleep(1) n = 200 for i in range(n):