correct idiom for time-aligned network tables? #6888
-
hey, i spent awhile measuring our camera latency, which varies depending on the alignment of the sensor row loop, the coprocessor cpu loop, and the rio main loop. i'd like to get the end-to-end latency to be correct, and i imagined the time-alignment of network tables would help. before i get too far down that road, i just wanted to verify (@PeterJohnson ?) what i'm supposed to do: in the (python) coprocessor client, i have an estimate of the "age" of a pose: publisher.set(pose, ntcore._now() - age_in_microsec) and in my (java) rio listener, i go: void listen(NetworkTableEvent event) {
var value = event.valueData.value;
var time = value.getServerTime() / 1e6;
var pose = someDecoder(value.getRaw());
poseEstimator.addVisionMeasurement(pose, time)
} so the "age" of the signal on the coprocessor is translated into the server time base. is that right? i think the key question is whether |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Yes, that’s the correct approach. |
Beta Was this translation helpful? Give feedback.
-
Unrelated to the original question- keep in mind that if you're using a listener callback, it will be called from a separate thread, so you'll want to synchronize accesses to the pose estimator. It's usually easier to either use |
Beta Was this translation helpful? Give feedback.
Yes, that’s the correct approach.