From 43b0e51906f0054fe4ba0dddf27ce90df443d8bd Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sun, 28 May 2023 11:59:01 -0700 Subject: [PATCH] show ign off time in count events debug script --- selfdrive/debug/count_events.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/selfdrive/debug/count_events.py b/selfdrive/debug/count_events.py index 42b671e5e3..a81d797b89 100755 --- a/selfdrive/debug/count_events.py +++ b/selfdrive/debug/count_events.py @@ -23,6 +23,7 @@ if __name__ == "__main__": alerts: List[Tuple[float, str]] = [] start_time = math.inf end_time = -math.inf + ignition_off = None for q in tqdm(r.qlog_paths()): if q is None: continue @@ -38,6 +39,11 @@ if __name__ == "__main__": if len(alerts) == 0 or alerts[-1][1] != msg.controlsState.alertType: t = (msg.logMonoTime - start_time) / 1e9 alerts.append((t, msg.controlsState.alertType)) + elif msg.which() == 'pandaStates': + if ignition_off is None: + ign = any(ps.ignitionLine or ps.ignitionCan for ps in msg.pandaStates) + if not ign: + ignition_off = msg.logMonoTime elif msg.which() in cams: cnt_cameras[msg.which()] += 1 @@ -64,6 +70,9 @@ if __name__ == "__main__": print("Alerts") for t, a in alerts: print(f"{t:8.2f} {a}") + if ignition_off is not None: + ignition_off = round((ignition_off - start_time) / 1e9, 2) + print("Ignition off at", ignition_off) print("\n") print("Route duration", datetime.timedelta(seconds=duration))