From d1bfb86ab42367f1ca73afd1ba51a81f57b57202 Mon Sep 17 00:00:00 2001 From: Andrew Gasser Date: Sun, 16 Oct 2022 22:51:48 -0500 Subject: [PATCH] Correct image capture time (#501) * Correct image capture time `Timer.getFPGATimesptamp()` returns the current time in _seconds_, but `res.getLatencyMillis()` is in _miliseconds_. * Correct image capture time (correctly) * Change double literal to not use suffix Co-authored-by: shueja-personal <32416547+shueja-personal@users.noreply.github.com> --- .../examples/simposeest/robot/DrivetrainPoseEstimator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/DrivetrainPoseEstimator.java b/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/DrivetrainPoseEstimator.java index 15ebf5779..c9e6480c4 100644 --- a/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/DrivetrainPoseEstimator.java +++ b/photonlib-java-examples/src/main/java/org/photonlib/examples/simposeest/robot/DrivetrainPoseEstimator.java @@ -86,7 +86,7 @@ public class DrivetrainPoseEstimator { var res = cam.getLatestResult(); if (res.hasTargets()) { - double imageCaptureTime = Timer.getFPGATimestamp() - res.getLatencyMillis(); + double imageCaptureTime = Timer.getFPGATimestamp() - res.getLatencyMillis() / 1000.0; Transform3d camToTargetTrans = res.getBestTarget().getCameraToTarget(); var transform = new Transform2d(