From 073631859551a3024cfe24133923798fc6aa26dd Mon Sep 17 00:00:00 2001 From: amquake Date: Sat, 4 Nov 2023 02:12:59 -0700 Subject: [PATCH 1/2] bump wpilib to beta-3 --- build.gradle | 4 ++-- photonlib-cpp-examples/build.gradle | 2 +- photonlib-java-examples/build.gradle | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index a869efc46e..fdf2fa70cb 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ plugins { id "com.diffplug.spotless" version "6.22.0" id "edu.wpi.first.NativeUtils" version "2024.2.0" apply false id "edu.wpi.first.wpilib.repositories.WPILibRepositoriesPlugin" version "2020.2" - id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-2" + id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-3" id 'edu.wpi.first.WpilibTools' version '1.3.0' } @@ -20,7 +20,7 @@ allprojects { apply from: "versioningHelper.gradle" ext { - wpilibVersion = "2024.1.1-beta-2" + wpilibVersion = "2024.1.1-beta-3" openCVversion = "4.8.0-2" joglVersion = "2.4.0-rc-20200307" javalinVersion = "5.6.2" diff --git a/photonlib-cpp-examples/build.gradle b/photonlib-cpp-examples/build.gradle index f86d65a4ae..881e04a114 100644 --- a/photonlib-cpp-examples/build.gradle +++ b/photonlib-cpp-examples/build.gradle @@ -1,6 +1,6 @@ plugins { id "com.diffplug.spotless" version "6.1.2" - id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-2" apply false + id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-3" apply false } allprojects { diff --git a/photonlib-java-examples/build.gradle b/photonlib-java-examples/build.gradle index 68dd2983a2..1c92e043f9 100644 --- a/photonlib-java-examples/build.gradle +++ b/photonlib-java-examples/build.gradle @@ -1,6 +1,6 @@ plugins { id "com.diffplug.spotless" version "6.1.2" - id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-2" apply false + id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-3" apply false } apply from: "examples.gradle" From 0eb0f9e2b1d63182e31f886e1791558c1f2d3ee9 Mon Sep 17 00:00:00 2001 From: amquake Date: Sat, 4 Nov 2023 02:25:02 -0700 Subject: [PATCH 2/2] make coproc multitag result relative to photon estimator origin --- .../main/java/org/photonvision/PhotonPoseEstimator.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/photon-lib/src/main/java/org/photonvision/PhotonPoseEstimator.java b/photon-lib/src/main/java/org/photonvision/PhotonPoseEstimator.java index 1c73f2cab2..32b4c7ba1f 100644 --- a/photon-lib/src/main/java/org/photonvision/PhotonPoseEstimator.java +++ b/photon-lib/src/main/java/org/photonvision/PhotonPoseEstimator.java @@ -100,7 +100,8 @@ public enum PoseStrategy { * @param fieldTags A WPILib {@link AprilTagFieldLayout} linking AprilTag IDs to Pose3d objects * with respect to the FIRST field using the Field - * Coordinate System. + * Coordinate System. Note that setting the origin of this layout object will affect the + * results from this class. * @param strategy The strategy it should use to determine the best pose. * @param camera PhotonCamera * @param robotToCamera Transform3d from the center of the robot to the camera mount position (ie, @@ -141,6 +142,8 @@ private void checkUpdate(Object oldObj, Object newObj) { /** * Get the AprilTagFieldLayout being used by the PositionEstimator. * + *

Note: Setting the origin of this layout will affect the results from this class. + * * @return the AprilTagFieldLayout */ public AprilTagFieldLayout getFieldTags() { @@ -150,6 +153,8 @@ public AprilTagFieldLayout getFieldTags() { /** * Set the AprilTagFieldLayout being used by the PositionEstimator. * + *

Note: Setting the origin of this layout will affect the results from this class. + * * @param fieldTags the AprilTagFieldLayout */ public void setFieldTags(AprilTagFieldLayout fieldTags) { @@ -415,6 +420,7 @@ private Optional multiTagOnCoprocStrategy( var best = new Pose3d() .plus(best_tf) // field-to-camera + .relativeTo(fieldTags.getOrigin()) .plus(robotToCamera.inverse()); // field-to-robot return Optional.of( new EstimatedRobotPose(