mirror of
https://github.com/PhotonVision/photonvision
synced 2026-07-03 03:01:40 +00:00
Fix Test Mode (#246)
* Fix test mode path and args * spoooootless * Fix unit test resources
This commit is contained in:
@@ -135,7 +135,8 @@ public class TestUtils {
|
||||
}
|
||||
|
||||
private static Path getResourcesFolderPath(boolean testMode) {
|
||||
return Path.of("src", (testMode ? "main" : "test"), "resources").toAbsolutePath();
|
||||
return Path.of((testMode ? "photon-server/src/main" : "src/test"), "resources")
|
||||
.toAbsolutePath();
|
||||
}
|
||||
|
||||
public static Path getTestMode2019ImagePath() {
|
||||
|
||||
@@ -58,7 +58,7 @@ public class CirclePNPTest {
|
||||
}
|
||||
|
||||
private CameraCalibrationCoefficients getCoeffs(String filename) {
|
||||
var cameraCalibration = TestUtils.getCoeffs(filename, true);
|
||||
var cameraCalibration = TestUtils.getCoeffs(filename, false);
|
||||
checkCameraCoefficients(cameraCalibration);
|
||||
return cameraCalibration;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class SolvePNPTest {
|
||||
}
|
||||
|
||||
private CameraCalibrationCoefficients getCoeffs(String filename) {
|
||||
var cameraCalibration = TestUtils.getCoeffs(filename, true);
|
||||
var cameraCalibration = TestUtils.getCoeffs(filename, false);
|
||||
checkCameraCoefficients(cameraCalibration);
|
||||
return cameraCalibration;
|
||||
}
|
||||
@@ -106,7 +106,7 @@ public class SolvePNPTest {
|
||||
TestUtils.getWPIImagePath(TestUtils.WPI2019Image.kCargoStraightDark48in, false),
|
||||
TestUtils.WPI2019Image.FOV,
|
||||
new Rotation2d(),
|
||||
TestUtils.get2019LifeCamCoeffs(true));
|
||||
TestUtils.get2019LifeCamCoeffs(false));
|
||||
|
||||
CVPipelineResult pipelineResult;
|
||||
|
||||
@@ -141,7 +141,7 @@ public class SolvePNPTest {
|
||||
TestUtils.getWPIImagePath(TestUtils.WPI2020Image.kBlueGoal_224in_Left, false),
|
||||
TestUtils.WPI2020Image.FOV,
|
||||
new Rotation2d(),
|
||||
TestUtils.get2020LifeCamCoeffs(true));
|
||||
TestUtils.get2020LifeCamCoeffs(false));
|
||||
|
||||
CVPipelineResult pipelineResult = pipeline.run(frameProvider.get(), QuirkyCamera.DefaultCamera);
|
||||
printTestResults(pipelineResult);
|
||||
|
||||
@@ -57,13 +57,11 @@ public class Main {
|
||||
final var options = new Options();
|
||||
options.addOption("d", "debug", false, "Enable debug logging prints");
|
||||
options.addOption("h", "help", false, "Show this help text and exit");
|
||||
if (!isRelease) {
|
||||
options.addOption(
|
||||
"t",
|
||||
"test-mode",
|
||||
false,
|
||||
"Run in test mode with 2019 and 2020 WPI field images in place of cameras");
|
||||
}
|
||||
options.addOption(
|
||||
"t",
|
||||
"test-mode",
|
||||
false,
|
||||
"Run in test mode with 2019 and 2020 WPI field images in place of cameras");
|
||||
|
||||
CommandLineParser parser = new DefaultParser();
|
||||
CommandLine cmd = parser.parse(options, args);
|
||||
|
||||
Reference in New Issue
Block a user