Vision pose estimator

When using the “AddVisionMeasurement()”, where can i get the timestamp?
From the limelight itself?
And how can I implement it? I already have the pose estimator setup(with - updateWithTime)

Great question! I’m not sure I can answer specifically for limelight but I can help with the theory.

The pose estimator needs to know “When the picture that produced this particular vision measurement was taken, what was the FPGA Timestamp”?

The more accurate you can be the better, but being off by a little bit isn’t the end of the world.

A simple implementation might be just to assume the processing and network latency is zero, and so you just supply Timer.getFPGATimestamp()

A better implementation is to have the coprocessor report how long it took to process the image. Then, you’d supply Timer.getFPGATimestamp() - processingLatency.

As a third option, Network Tables 4 has a really nifty feature where it will synchronize a clock on the coprocessor with the RIO’s FPGA. If your coprocessor software supports it, it can record the exact time the image is taken on the camera, and will timestamp the NT4 data with that information. In this cases, you simply supply the time the coprocessor tells you to the pose estimator. The getAtomic() functions in NT4 return the value and timestamp pairs.

1 Like

Thank you so much, where can I find more details about this topic, cuz I haven’t found a good documentation website yet, and the explanation in the FRC docs isn’t the best thing.
Thank u again.

That’s a great question as well.

I honestly have no idea. I only knew it because of multiple years of staring at the problem, and having written multiple NT4 and NT4-like implementations myself.

https://www.youtube.com/watch?v=rLwOkAJqImo is a good start - it’s older, but a lot of the core concepts still apply.

A docs page should probably get written somewhere :slight_smile:

The Limelight docs have a small section on this, you can scroll down to the “Using WPILib’s Pose Estimator” section. Not super detailed, but useful.

I sent @Brandon_Hjelstrom a pull request for LimelightLib that calculates the timestamp. It’s based on the NT4 timestamp and the pipeline latency, as @gerthworm suggested.

Take a look at the PR here. If you’re using LL lib, you can just copy the whole file from my repo instead of theirs.

If you’re using different code to read the value from the limelight, the key is to use the poseEntry.getLastChange() value and add the pipeline latency (element 7, index 6, in the pose array).

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.