diff --git a/photon-core/src/main/java/org/photonvision/common/util/TestUtils.java b/photon-core/src/main/java/org/photonvision/common/util/TestUtils.java index 721de6994..110833c44 100644 --- a/photon-core/src/main/java/org/photonvision/common/util/TestUtils.java +++ b/photon-core/src/main/java/org/photonvision/common/util/TestUtils.java @@ -144,6 +144,24 @@ public class TestUtils { } } + public enum WPI2024Images { + kBackAmpZone_117in, + kSpeakerCenter_143in; + + public static double FOV = 68.5; + + public final Path path; + + Path getPath() { + var filename = this.toString().substring(1); + return Path.of("2024", filename + ".jpg"); + } + + WPI2024Images() { + this.path = getPath(); + } + } + public enum WPI2023Apriltags { k162_36_Angle, k162_36_Straight, diff --git a/photon-server/src/main/java/org/photonvision/Main.java b/photon-server/src/main/java/org/photonvision/Main.java index e7db45c1f..469cec876 100644 --- a/photon-server/src/main/java/org/photonvision/Main.java +++ b/photon-server/src/main/java/org/photonvision/Main.java @@ -40,6 +40,7 @@ import org.photonvision.common.util.numbers.IntegerCouple; import org.photonvision.mrcal.MrCalJNILoader; import org.photonvision.raspi.LibCameraJNILoader; import org.photonvision.server.Server; +import org.photonvision.vision.apriltag.AprilTagFamily; import org.photonvision.vision.camera.FileVisionSource; import org.photonvision.vision.opencv.CVMat; import org.photonvision.vision.opencv.ContourGroupingMode; @@ -261,6 +262,34 @@ public class Main { camConf2023.pipelineSettings = psList2023; } + CameraConfiguration camConf2024 = + ConfigManager.getInstance().getConfig().getCameraConfigurations().get("WPI2024"); + if (camConf2024 == null || true) { + camConf2024 = + new CameraConfiguration( + "WPI2024", + TestUtils.getResourcesFolderPath(true) + .resolve("testimages") + .resolve(TestUtils.WPI2024Images.kSpeakerCenter_143in.path) + .toString()); + + camConf2024.FOV = TestUtils.WPI2024Images.FOV; + // same camera as 2023 + camConf2024.calibrations.add(TestUtils.get2023LifeCamCoeffs(true)); + + var pipeline2024 = new AprilTagPipelineSettings(); + var path_split = Path.of(camConf2024.path).getFileName().toString(); + pipeline2024.pipelineNickname = path_split.replace(".jpg", ""); + pipeline2024.targetModel = TargetModel.kAprilTag6p5in_36h11; + pipeline2024.tagFamily = AprilTagFamily.kTag36h11; + pipeline2024.inputShouldShow = true; + pipeline2024.solvePNPEnabled = true; + + var psList2024 = new ArrayList(); + psList2024.add(pipeline2024); + camConf2024.pipelineSettings = psList2024; + } + // Colored shape testing var camConfShape = ConfigManager.getInstance().getConfig().getCameraConfigurations().get("Shape"); @@ -290,12 +319,14 @@ public class Main { var fvs2020 = new FileVisionSource(camConf2020); var fvs2022 = new FileVisionSource(camConf2022); var fvs2023 = new FileVisionSource(camConf2023); + var fvs2024 = new FileVisionSource(camConf2024); - collectedSources.add(fvs2023); - collectedSources.add(fvs2022); - collectedSources.add(fvsShape); - collectedSources.add(fvs2020); - collectedSources.add(fvs2019); + collectedSources.add(fvs2024); + // collectedSources.add(fvs2023); + // collectedSources.add(fvs2022); + // collectedSources.add(fvsShape); + // collectedSources.add(fvs2020); + // collectedSources.add(fvs2019); ConfigManager.getInstance().unloadCameraConfigs(); VisionModuleManager.getInstance().addSources(collectedSources).forEach(VisionModule::start); diff --git a/test-resources/testimages/2024/Amp_42in.jpg b/test-resources/testimages/2024/Amp_42in.jpg new file mode 100644 index 000000000..7ff5fa5db Binary files /dev/null and b/test-resources/testimages/2024/Amp_42in.jpg differ diff --git a/test-resources/testimages/2024/Amp_85in.jpg b/test-resources/testimages/2024/Amp_85in.jpg new file mode 100644 index 000000000..50a31fc67 Binary files /dev/null and b/test-resources/testimages/2024/Amp_85in.jpg differ diff --git a/test-resources/testimages/2024/BackAmpZone_117in.jpg b/test-resources/testimages/2024/BackAmpZone_117in.jpg new file mode 100644 index 000000000..ab12d9c18 Binary files /dev/null and b/test-resources/testimages/2024/BackAmpZone_117in.jpg differ diff --git a/test-resources/testimages/2024/GeneralField1.jpg b/test-resources/testimages/2024/GeneralField1.jpg new file mode 100644 index 000000000..6f1a95ed3 Binary files /dev/null and b/test-resources/testimages/2024/GeneralField1.jpg differ diff --git a/test-resources/testimages/2024/GeneralField2.jpg b/test-resources/testimages/2024/GeneralField2.jpg new file mode 100644 index 000000000..6120aae38 Binary files /dev/null and b/test-resources/testimages/2024/GeneralField2.jpg differ diff --git a/test-resources/testimages/2024/GeneralField3.jpg b/test-resources/testimages/2024/GeneralField3.jpg new file mode 100644 index 000000000..4d2de1269 Binary files /dev/null and b/test-resources/testimages/2024/GeneralField3.jpg differ diff --git a/test-resources/testimages/2024/GeneralField4.jpg b/test-resources/testimages/2024/GeneralField4.jpg new file mode 100644 index 000000000..655cff433 Binary files /dev/null and b/test-resources/testimages/2024/GeneralField4.jpg differ diff --git a/test-resources/testimages/2024/GeneralField5.jpg b/test-resources/testimages/2024/GeneralField5.jpg new file mode 100644 index 000000000..854fc35cc Binary files /dev/null and b/test-resources/testimages/2024/GeneralField5.jpg differ diff --git a/test-resources/testimages/2024/Loading_83in.jpg b/test-resources/testimages/2024/Loading_83in.jpg new file mode 100644 index 000000000..fb3c73405 Binary files /dev/null and b/test-resources/testimages/2024/Loading_83in.jpg differ diff --git a/test-resources/testimages/2024/Podium_103in.jpg b/test-resources/testimages/2024/Podium_103in.jpg new file mode 100644 index 000000000..6eef431f7 Binary files /dev/null and b/test-resources/testimages/2024/Podium_103in.jpg differ diff --git a/test-resources/testimages/2024/README.txt b/test-resources/testimages/2024/README.txt new file mode 100644 index 000000000..37342b451 --- /dev/null +++ b/test-resources/testimages/2024/README.txt @@ -0,0 +1,13 @@ +This folder contains images of the AprilTags on the 2024 playing field. All measurements included +are approximate and are intended to give a rough idea of views from various distances from field +elements. All images were taken with a Microsoft Lifecam at 1280x720 resolution. +Camera height: ~29.75 in +Camera ~20 degrees pitch above horizontal +The folder includes 2 types of images: +1. "General Field" images which provide a +general idea of the view from various spots on the field with a camera at this +height and angle. +2. Specific field element images which include a measurement away from a specific field element. +The Amp, Loading, and Stage photos are measured to the face of the respective elements, +approximately perpendicular from the face. The remaining photos are all measured to the center of +the subwoofer face, perpendicular or diagonal as necessary. diff --git a/test-resources/testimages/2024/SpeakerCenter_143in.jpg b/test-resources/testimages/2024/SpeakerCenter_143in.jpg new file mode 100644 index 000000000..6d1b92836 Binary files /dev/null and b/test-resources/testimages/2024/SpeakerCenter_143in.jpg differ diff --git a/test-resources/testimages/2024/SpeakerCenter_19in.jpg b/test-resources/testimages/2024/SpeakerCenter_19in.jpg new file mode 100644 index 000000000..98623ffe1 Binary files /dev/null and b/test-resources/testimages/2024/SpeakerCenter_19in.jpg differ diff --git a/test-resources/testimages/2024/SpeakerCenter_63in.jpg b/test-resources/testimages/2024/SpeakerCenter_63in.jpg new file mode 100644 index 000000000..280a04a9a Binary files /dev/null and b/test-resources/testimages/2024/SpeakerCenter_63in.jpg differ diff --git a/test-resources/testimages/2024/StageLeft_51in.jpg b/test-resources/testimages/2024/StageLeft_51in.jpg new file mode 100644 index 000000000..745d29250 Binary files /dev/null and b/test-resources/testimages/2024/StageLeft_51in.jpg differ diff --git a/test-resources/testimages/2024/StageRight_51in.jpg b/test-resources/testimages/2024/StageRight_51in.jpg new file mode 100644 index 000000000..a3673e857 Binary files /dev/null and b/test-resources/testimages/2024/StageRight_51in.jpg differ