From 3ec06830e7a73b1820365cabf548d5b5f4f709e0 Mon Sep 17 00:00:00 2001 From: remilia Date: Thu, 15 May 2025 22:28:45 +0800 Subject: [PATCH] add recvplot3 --- flandre/launcher.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/flandre/launcher.py b/flandre/launcher.py index 7215987..fb172a5 100644 --- a/flandre/launcher.py +++ b/flandre/launcher.py @@ -272,7 +272,7 @@ def device_recvplot(): host_host_ts_last = host_host_ts @device.command('recvplot2') -def device_recvplot(): +def device_recvplot2(): ctx = zmq.Context() pull = ctx.socket(zmq.PULL) pull.connect(C.live_push_socket) @@ -284,6 +284,28 @@ def device_recvplot(): print((host_host_ts - host_host_ts_last) / 10 ** 6, flush=True) host_host_ts_last = host_host_ts +@device.command('recvplot3') +def device_recvplot3(): + ctx = zmq.Context() + pull = ctx.socket(zmq.PULL) + pull.connect(C.live_push_socket) + last_ts = 0 + first = True + host_host_ts_last = time.time_ns() + while True: + b = pull.recv() + host_host_ts = time.time_ns() + + seq, encoder, host_ts, device_ts_low, device_ts_high, buffer = b2t(b) + ts = host_ts + if first: + last_ts = ts + first = False + continue + print((ts - last_ts) / 10 ** 6,(host_host_ts - host_host_ts_last) / 10 ** 6, flush=True) + last_ts = ts + host_host_ts_last = host_host_ts + @device.command('recvplotdiff') def device_recvplotdiff(): ctx = zmq.Context()