From ef5e6463cbeb86bbdf6bdcf76d53f756ebb94d7d Mon Sep 17 00:00:00 2001 From: Jade Date: Sat, 12 Jul 2025 17:44:55 +0800 Subject: [PATCH] Clarify and fix OpenCV/WPILib version checking error (#1963) ## Description Fixed the error in the OpenCV/WPILib version checking crash and clarified it, since it's not PhotonVision that needs updating, but rather WPILib. Reported on chief https://www.chiefdelphi.com/t/opencv-is-version-4-6-0-and-needs-to-be-4-10-0/501751/7 ## Meta Merge checklist: - [x] Pull Request title is [short, imperative summary](https://cbea.ms/git-commit/) of proposed changes - [x] The description documents the _what_ and _why_ - [ ] If this PR changes behavior or adds a feature, user documentation is updated - [ ] If this PR touches photon-serde, all messages have been regenerated and hashes have not changed unexpectedly - [ ] If this PR touches configuration, this is backwards compatible with settings back to v2024.3.1 - [ ] If this PR touches pipeline settings or anything related to data exchange, the frontend typing is updated - [ ] If this PR addresses a bug, a regression test for it is added --------- Signed-off-by: Jade Turner Co-authored-by: Gold856 <117957790+Gold856@users.noreply.github.com> --- .../java/org/photonvision/PhotonCamera.java | 30 ++++++++++++++----- .../main/native/cpp/photon/PhotonCamera.cpp | 26 ++++++++++++---- 2 files changed, 42 insertions(+), 14 deletions(-) diff --git a/photon-lib/src/main/java/org/photonvision/PhotonCamera.java b/photon-lib/src/main/java/org/photonvision/PhotonCamera.java index eb2772adf..d1f5d6961 100644 --- a/photon-lib/src/main/java/org/photonvision/PhotonCamera.java +++ b/photon-lib/src/main/java/org/photonvision/PhotonCamera.java @@ -195,11 +195,18 @@ public class PhotonCamera implements AutoCloseable { + ">>> but you are using WPILib " + WPILibVersion.Version + """ - >>> \s + \n>>> \s >>> This is neither tested nor supported. \s - >>> You MUST update PhotonVision, \s - >>> PhotonLib, or both. \s - >>> Verify the output of `./gradlew dependencies` + >>> You MUST update WPILib, PhotonLib, or both. + >>> Check `./gradlew dependencies` and ensure\s + >>> all mentions of OpenCV match the version \s + >>> that PhotonLib was built for. If you find a + >>> a mismatched version in a dependency, you\s + >>> must take steps to update the version of \s + >>> OpenCV used in that dependency. If you do\s + >>> not control that dependency and an updated\s + >>> version is not available, contact the \s + >>> developers of that dependency. \s >>> \s >>> Your code will now crash. \s >>> We hope your day gets better. \s @@ -232,11 +239,18 @@ public class PhotonCamera implements AutoCloseable { + ">>> but you are using OpenCV " + Core.VERSION + """ - >>> \s + \n>>> \s >>> This is neither tested nor supported. \s - >>> You MUST update PhotonVision, \s - >>> PhotonLib, or both. \s - >>> Verify the output of `./gradlew dependencies` + >>> You MUST update WPILib, PhotonLib, or both. + >>> Check `./gradlew dependencies` and ensure\s + >>> all mentions of OpenCV match the version \s + >>> that PhotonLib was built for. If you find a + >>> a mismatched version in a dependency, you\s + >>> must take steps to update the version of \s + >>> OpenCV used in that dependency. If you do\s + >>> not control that dependency and an updated\s + >>> version is not available, contact the \s + >>> developers of that dependency. \s >>> \s >>> Your code will now crash. \s >>> We hope your day gets better. \s diff --git a/photon-lib/src/main/native/cpp/photon/PhotonCamera.cpp b/photon-lib/src/main/native/cpp/photon/PhotonCamera.cpp index c0c29462e..6b7f67bc8 100644 --- a/photon-lib/src/main/native/cpp/photon/PhotonCamera.cpp +++ b/photon-lib/src/main/native/cpp/photon/PhotonCamera.cpp @@ -69,9 +69,16 @@ inline void verifyDependencies() { bfw += "\n>>> \n" ">>> This is neither tested nor supported. \n" - ">>> You MUST update PhotonVision, \n" - ">>> PhotonLib, or both. \n" - ">>> Verify the output of `./gradlew dependencies` \n" + ">>> You MUST update WPILib, PhotonLib, or both.\n" + ">>> Check `./gradlew dependencies` and ensure\n" + ">>> all mentions of WPILib match the version \n" + ">>> that PhotonLib was built for. If you find a" + ">>> a mismatched version in a dependency, you\n" + ">>> must take steps to update the version of \n" + ">>> WPILib used in that dependency. If you do\n" + ">>> not control that dependency and an updated\n" + ">>> version is not available, contact the \n" + ">>> developers of that dependency. \n" ">>> \n" ">>> Your code will now crash. \n" ">>> We hope your day gets better. \n" @@ -104,9 +111,16 @@ inline void verifyDependencies() { bfw += "\n>>> \n" ">>> This is neither tested nor supported. \n" - ">>> You MUST update PhotonVision, \n" - ">>> PhotonLib, or both. \n" - ">>> Verify the output of `./gradlew dependencies` \n" + ">>> You MUST update WPILib, PhotonLib, or both.\n" + ">>> Check `./gradlew dependencies` and ensure\n" + ">>> all mentions of OpenCV match the version \n" + ">>> that PhotonLib was built for. If you find a" + ">>> a mismatched version in a dependency, you\n" + ">>> must take steps to update the version of \n" + ">>> OpenCV used in that dependency. If you do\n" + ">>> not control that dependency and an updated\n" + ">>> version is not available, contact the \n" + ">>> developers of that dependency. \n" ">>> \n" ">>> Your code will now crash. \n" ">>> We hope your day gets better. \n"