mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-21 00:03:45 +08:00
fb77feccd8
* equalize performance on three threads * need to request first * clean up indexing * obsolete * handling skips and drops * clean up repeated chunks * use main frame id * oneshot * real skip check * move to test * should be cropped H here Co-authored-by: Comma Device <device@comma.ai> old-commit-hash: 13588e4255e3667459bc5b23068dbccd2fab2a39
28 lines
728 B
Python
Executable File
28 lines
728 B
Python
Executable File
#!/usr/bin/env python3
|
|
# type: ignore
|
|
import cereal.messaging as messaging
|
|
|
|
all_sockets = ['frame','frontFrame','wideFrame']
|
|
prev_id = [None,None,None]
|
|
this_id = [None,None,None]
|
|
dt = [None,None,None]
|
|
num_skipped = [0,0,0]
|
|
|
|
if __name__ == "__main__":
|
|
sm = messaging.SubMaster(all_sockets)
|
|
while True:
|
|
sm.update()
|
|
|
|
for i in range(len(all_sockets)):
|
|
if not sm.updated[all_sockets[i]]:
|
|
continue
|
|
this_id[i] = sm[all_sockets[i]].frameId
|
|
if prev_id[i] is None:
|
|
prev_id[i] = this_id[i]
|
|
continue
|
|
dt[i] = this_id[i] - prev_id[i]
|
|
if dt[i] != 1:
|
|
num_skipped[i] += dt[i] - 1
|
|
print(all_sockets[i] ,dt[i] - 1, num_skipped[i])
|
|
prev_id[i] = this_id[i]
|