pandad: fix loopback test (#32656)

* pandad: fix loopback test

* clear all params

* try this

---------

Co-authored-by: Comma Device <device@comma.ai>
old-commit-hash: 57f21abb4f
This commit is contained in:
Adeeb Shihadeh 2024-06-07 23:58:14 -07:00 committed by GitHub
parent 945c6b94fa
commit ae8f9da48d
1 changed files with 7 additions and 2 deletions

View File

@ -20,10 +20,11 @@ from openpilot.selfdrive.test.helpers import phone_only, with_processes
@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 @@ class TestBoarddLoopback:
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):