From 45a39f66094aecad53f014d971f7071d7e6407cc Mon Sep 17 00:00:00 2001 From: Craig Schardt Date: Sun, 4 Feb 2024 19:42:01 -0800 Subject: [PATCH 1/3] Remove duplicate video modes (#1221) (Fixes #1219) --- .../java/org/photonvision/vision/camera/USBCameraSource.java | 1 + 1 file changed, 1 insertion(+) diff --git a/photon-core/src/main/java/org/photonvision/vision/camera/USBCameraSource.java b/photon-core/src/main/java/org/photonvision/vision/camera/USBCameraSource.java index 9548fd2c19..15f67200ad 100644 --- a/photon-core/src/main/java/org/photonvision/vision/camera/USBCameraSource.java +++ b/photon-core/src/main/java/org/photonvision/vision/camera/USBCameraSource.java @@ -395,6 +395,7 @@ public HashMap getAllVideoModes() { // Sort by resolution var sortedList = videoModesList.stream() + .distinct() // remove redundant video mode entries .sorted(((a, b) -> (b.width + b.height) - (a.width + a.height))) .collect(Collectors.toList()); Collections.reverse(sortedList); From 7666f152bb51d3e6dfd8517bfa7e758b839661de Mon Sep 17 00:00:00 2001 From: Chris Gerth Date: Mon, 5 Feb 2024 06:48:39 -0800 Subject: [PATCH 2/3] Fix chessboard gen for unique square sizes (#1217) --- photon-client/src/components/cameras/CameraCalibrationCard.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/photon-client/src/components/cameras/CameraCalibrationCard.vue b/photon-client/src/components/cameras/CameraCalibrationCard.vue index 29b4d2b888..d9eca1a369 100644 --- a/photon-client/src/components/cameras/CameraCalibrationCard.vue +++ b/photon-client/src/components/cameras/CameraCalibrationCard.vue @@ -102,7 +102,7 @@ const downloadCalibBoard = () => { const yPos = chessboardStartY + squareY * squareSizeIn.value; // Only draw the odd squares to create the chessboard pattern - if ((xPos + yPos + 0.25) % 2 === 0) { + if (squareY % 2 != squareX % 2) { doc.rect(xPos, yPos, squareSizeIn.value, squareSizeIn.value, "F"); } } From 0eb0a4e3c58c0ac643c9da9bfc24c18936a05078 Mon Sep 17 00:00:00 2001 From: Tim Winters Date: Mon, 5 Feb 2024 09:50:36 -0500 Subject: [PATCH 3/3] Store the last pose on update (#1207) * Store the last pose on update * Don't clear lastPose if pose isn't calculated --------- Co-authored-by: Mohammad Durrani <46766905+mdurrani808@users.noreply.github.com> --- .../src/main/java/org/photonvision/PhotonPoseEstimator.java | 4 ++-- photon-lib/src/main/native/cpp/photon/PhotonPoseEstimator.cpp | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/photon-lib/src/main/java/org/photonvision/PhotonPoseEstimator.java b/photon-lib/src/main/java/org/photonvision/PhotonPoseEstimator.java index f93c499140..6b217c9b73 100644 --- a/photon-lib/src/main/java/org/photonvision/PhotonPoseEstimator.java +++ b/photon-lib/src/main/java/org/photonvision/PhotonPoseEstimator.java @@ -408,8 +408,8 @@ private Optional update( return Optional.empty(); } - if (estimatedPose.isEmpty()) { - lastPose = null; + if (estimatedPose.isPresent()) { + lastPose = estimatedPose.get().estimatedPose; } return estimatedPose; diff --git a/photon-lib/src/main/native/cpp/photon/PhotonPoseEstimator.cpp b/photon-lib/src/main/native/cpp/photon/PhotonPoseEstimator.cpp index 30bc6de2df..d14394b999 100644 --- a/photon-lib/src/main/native/cpp/photon/PhotonPoseEstimator.cpp +++ b/photon-lib/src/main/native/cpp/photon/PhotonPoseEstimator.cpp @@ -186,6 +186,9 @@ std::optional PhotonPoseEstimator::Update( ret = std::nullopt; } + if (ret) { + lastPose = ret.value().estimatedPose; + } return ret; }