Skip to content

Commit

Permalink
Add 2024 test mode
Browse files Browse the repository at this point in the history
  • Loading branch information
mcm001 committed Jan 8, 2024
1 parent 02df8aa commit 8879248
Show file tree
Hide file tree
Showing 18 changed files with 68 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,24 @@ Path getPath() {
}
}

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,
Expand Down
43 changes: 37 additions & 6 deletions photon-server/src/main/java/org/photonvision/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
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;
Expand Down Expand Up @@ -261,6 +262,34 @@ private static void addTestModeSources() {
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<CVPipelineSettings>();
psList2024.add(pipeline2024);
camConf2024.pipelineSettings = psList2024;
}

// Colored shape testing
var camConfShape =
ConfigManager.getInstance().getConfig().getCameraConfigurations().get("Shape");
Expand Down Expand Up @@ -290,12 +319,14 @@ private static void addTestModeSources() {
var fvs2020 = new FileVisionSource(camConf2020);
var fvs2022 = new FileVisionSource(camConf2022);
var fvs2023 = new FileVisionSource(camConf2023);

collectedSources.add(fvs2023);
collectedSources.add(fvs2022);
collectedSources.add(fvsShape);
collectedSources.add(fvs2020);
collectedSources.add(fvs2019);
var fvs2024 = new FileVisionSource(camConf2024);

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);
Expand Down
Binary file added test-resources/testimages/2024/Amp_42in.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test-resources/testimages/2024/Amp_85in.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test-resources/testimages/2024/GeneralField1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test-resources/testimages/2024/GeneralField2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test-resources/testimages/2024/GeneralField3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test-resources/testimages/2024/GeneralField4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test-resources/testimages/2024/GeneralField5.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test-resources/testimages/2024/Loading_83in.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test-resources/testimages/2024/Podium_103in.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions test-resources/testimages/2024/README.txt
Original file line number Diff line number Diff line change
@@ -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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8879248

Please sign in to comment.