From 8162a2b85683c52d2437051a57f8e8b152d92ed5 Mon Sep 17 00:00:00 2001 From: Justin Newberry Date: Wed, 7 Feb 2024 20:25:17 -0500 Subject: [PATCH] test_time_to_onroad: log events after engagability/timeout (#31362) log engagability Co-authored-by: Comma Device old-commit-hash: e6f42fa6b3914c738341b3830bbcd7c9abf9a965 --- selfdrive/test/test_time_to_onroad.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/selfdrive/test/test_time_to_onroad.py b/selfdrive/test/test_time_to_onroad.py index 7e8c85c356..9288188a77 100755 --- a/selfdrive/test/test_time_to_onroad.py +++ b/selfdrive/test/test_time_to_onroad.py @@ -21,23 +21,23 @@ def test_time_to_onroad(): sm = messaging.SubMaster(['controlsState', 'deviceState', 'onroadEvents']) try: # wait for onroad + with Timeout(20, "timed out waiting to go onroad"): + while True: + sm.update(1000) + if sm['deviceState'].started: + break + time.sleep(1) + + # wait for engageability try: - with Timeout(20, "timed out waiting to go onroad"): + with Timeout(10, "timed out waiting for engageable"): while True: sm.update(1000) - if sm['deviceState'].started: + if sm['controlsState'].engageable: break time.sleep(1) finally: print(f"onroad events: {sm['onroadEvents']}") - - # wait for engageability - with Timeout(10, "timed out waiting for engageable"): - while True: - sm.update(1000) - if sm['controlsState'].engageable: - break - time.sleep(1) print(f"engageable after {time.monotonic() - start_time:.2f}s") # once we're enageable, must be for the next few seconds