|
|
|
@ -5,7 +5,7 @@ import datetime |
|
|
|
|
from collections import Counter |
|
|
|
|
from pprint import pprint |
|
|
|
|
from tqdm import tqdm |
|
|
|
|
from typing import cast |
|
|
|
|
from typing import List, Tuple, cast |
|
|
|
|
|
|
|
|
|
from cereal.services import service_list |
|
|
|
|
from tools.lib.route import Route |
|
|
|
@ -20,6 +20,7 @@ if __name__ == "__main__": |
|
|
|
|
cams = [s for s in service_list if s.endswith('CameraState')] |
|
|
|
|
cnt_cameras = dict.fromkeys(cams, 0) |
|
|
|
|
|
|
|
|
|
alerts: List[Tuple[float, str]] = [] |
|
|
|
|
start_time = math.inf |
|
|
|
|
end_time = -math.inf |
|
|
|
|
for q in tqdm(r.qlog_paths()): |
|
|
|
@ -27,18 +28,22 @@ if __name__ == "__main__": |
|
|
|
|
continue |
|
|
|
|
lr = list(LogReader(q)) |
|
|
|
|
for msg in lr: |
|
|
|
|
end_time = max(end_time, msg.logMonoTime) |
|
|
|
|
start_time = min(start_time, msg.logMonoTime) |
|
|
|
|
|
|
|
|
|
if msg.which() == 'carEvents': |
|
|
|
|
for e in msg.carEvents: |
|
|
|
|
cnt_events[e.name] += 1 |
|
|
|
|
elif msg.which() == 'controlsState': |
|
|
|
|
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() in cams: |
|
|
|
|
cnt_cameras[msg.which()] += 1 |
|
|
|
|
|
|
|
|
|
if not msg.valid: |
|
|
|
|
cnt_valid[msg.which()] += 1 |
|
|
|
|
|
|
|
|
|
end_time = max(end_time, msg.logMonoTime) |
|
|
|
|
start_time = min(start_time, msg.logMonoTime) |
|
|
|
|
|
|
|
|
|
duration = (end_time - start_time) / 1e9 |
|
|
|
|
|
|
|
|
|
print("Events") |
|
|
|
@ -55,5 +60,10 @@ if __name__ == "__main__": |
|
|
|
|
expected_frames = int(s.frequency * duration / cast(float, s.decimation)) |
|
|
|
|
print(" ", k.ljust(20), f"{v}, {v/expected_frames:.1%} of expected") |
|
|
|
|
|
|
|
|
|
print("\n") |
|
|
|
|
print("Alerts") |
|
|
|
|
for t, a in alerts: |
|
|
|
|
print(f"{t:8.2f} {a}") |
|
|
|
|
|
|
|
|
|
print("\n") |
|
|
|
|
print("Route duration", datetime.timedelta(seconds=duration)) |
|
|
|
|