Clean up front end, remove decision margin and error bits, remove target family selector (#652)

* clean up front end ui

* address changes

* Further tweaks to camera default gains to help make sure users get a good first impression

* even more saner defaults

* Even even more camera sane defaults

* lint

* lint pt 2

* unit test fixup

Co-authored-by: Chris <chrisgerth010592@gmail.com>
This commit is contained in:
Mohammad Durrani
2022-12-31 18:29:36 -05:00
committed by GitHub
parent d0bf64af6c
commit 1ab5b66829
10 changed files with 168 additions and 213 deletions

View File

@@ -69,28 +69,7 @@ public class AprilTagPipeline extends CVPipeline<CVPipelineResult, AprilTagPipel
// target model for the draw 3d targets pipeline to work...
// for now, hard code tag width based on enum value
double tagWidth;
// This needs
switch (settings.targetModel) {
case k200mmAprilTag:
{
tagWidth = Units.inchesToMeters(3.25 * 2);
break;
}
case k6in_16h5:
{
tagWidth = Units.inchesToMeters(3 * 2);
break;
}
default:
{
// guess at 200mm?? If it's zero everything breaks, but it should _never_ be zero. Unless
// users select the wrong model...
tagWidth = 0.16;
break;
}
}
double tagWidth = Units.inchesToMeters(3 * 2); // for 6in 16h5 tag.
// AprilTagDetectorParams aprilTagDetectionParams =
// new AprilTagDetectorParams(

View File

@@ -24,17 +24,15 @@ import org.photonvision.vision.target.TargetModel;
@JsonTypeName("AprilTagPipelineSettings")
public class AprilTagPipelineSettings extends AdvancedPipelineSettings {
public AprilTagFamily tagFamily = AprilTagFamily.kTag36h11;
public AprilTagFamily tagFamily = AprilTagFamily.kTag16h5;
public int decimate = 1;
public double blur = 0;
public int threads = 1;
public int threads = 4; // Multiple threads seems to be better performance on most platforms
public boolean debug = false;
public boolean refineEdges = true;
public int numIterations = 200;
// TODO is this a legit, reasonable default?
public int hammingDist = 1;
public int decisionMargin = 30;
public int hammingDist = 0;
public int decisionMargin = 35;
// 3d settings
@@ -42,7 +40,9 @@ public class AprilTagPipelineSettings extends AdvancedPipelineSettings {
super();
pipelineType = PipelineType.AprilTag;
outputShowMultipleTargets = true;
targetModel = TargetModel.k200mmAprilTag;
targetModel = TargetModel.k6in_16h5;
cameraExposure = 20;
cameraAutoExposure = false;
ledMode = false;
}

View File

@@ -40,14 +40,14 @@ public class CVPipelineSettings implements Cloneable {
public String pipelineNickname = "New Pipeline";
public boolean cameraAutoExposure = false;
// manual exposure only used if cameraAutoExposure if false
public double cameraExposure = 100;
public double cameraExposure = 20;
public int cameraBrightness = 50;
// Currently only used by a few cameras (notably the zero-copy Pi Camera driver) with the Gain
// quirk
public int cameraGain = 50;
public int cameraGain = 75;
// Currently only used by the zero-copy Pi Camera driver
public int cameraRedGain = 18;
public int cameraBlueGain = 24;
public int cameraRedGain = 11;
public int cameraBlueGain = 20;
public int cameraVideoModeIndex = 0;
public FrameDivisor streamingFrameDivisor = FrameDivisor.NONE;
public boolean ledMode = false;

View File

@@ -30,7 +30,7 @@ public class Calibration3dPipelineSettings extends AdvancedPipelineSettings {
public Calibration3dPipelineSettings() {
super();
this.cameraAutoExposure = true;
this.inputShouldShow = true;
this.outputShouldShow = true;
}

View File

@@ -45,6 +45,7 @@ public class ColoredShapePipelineSettings extends AdvancedPipelineSettings {
public ColoredShapePipelineSettings() {
super();
pipelineType = PipelineType.ColoredShape;
cameraExposure = 20;
}
@Override

View File

@@ -31,5 +31,6 @@ public class DriverModePipelineSettings extends CVPipelineSettings {
pipelineIndex = PipelineManager.DRIVERMODE_INDEX;
pipelineType = PipelineType.DriverMode;
inputShouldShow = true;
cameraAutoExposure = true;
}
}

View File

@@ -27,5 +27,7 @@ public class ReflectivePipelineSettings extends AdvancedPipelineSettings {
public ReflectivePipelineSettings() {
super();
pipelineType = PipelineType.Reflective;
cameraExposure = 6;
cameraGain = 20;
}
}

View File

@@ -104,14 +104,14 @@ public class VisionModule {
if (cameraQuirks.hasQuirk(CameraQuirk.Gain)) {
pipelineManager.userPipelineSettings.forEach(
it -> {
if (it.cameraGain == -1) it.cameraGain = 20; // Sane default
if (it.cameraGain == -1) it.cameraGain = 75; // Sane default
});
}
if (cameraQuirks.hasQuirk(CameraQuirk.AWBGain)) {
pipelineManager.userPipelineSettings.forEach(
it -> {
if (it.cameraRedGain == -1) it.cameraRedGain = 16; // Sane defaults
if (it.cameraBlueGain == -1) it.cameraBlueGain = 16;
if (it.cameraRedGain == -1) it.cameraRedGain = 11; // Sane defaults
if (it.cameraBlueGain == -1) it.cameraBlueGain = 20;
});
}
@@ -401,7 +401,7 @@ public class VisionModule {
}
if (cameraQuirks.hasQuirk(CameraQuirk.Gain)) {
// If the gain is disabled for some reason, re-enable it
if (pipelineSettings.cameraGain == -1) pipelineSettings.cameraGain = 20;
if (pipelineSettings.cameraGain == -1) pipelineSettings.cameraGain = 75;
visionSource.getSettables().setGain(Math.max(0, pipelineSettings.cameraGain));
} else {
pipelineSettings.cameraGain = -1;
@@ -409,8 +409,8 @@ public class VisionModule {
if (cameraQuirks.hasQuirk(CameraQuirk.AWBGain)) {
// If the AWB gains are disabled for some reason, re-enable it
if (pipelineSettings.cameraRedGain == -1) pipelineSettings.cameraRedGain = 16;
if (pipelineSettings.cameraBlueGain == -1) pipelineSettings.cameraBlueGain = 16;
if (pipelineSettings.cameraRedGain == -1) pipelineSettings.cameraRedGain = 11;
if (pipelineSettings.cameraBlueGain == -1) pipelineSettings.cameraBlueGain = 20;
visionSource.getSettables().setRedGain(Math.max(0, pipelineSettings.cameraRedGain));
visionSource.getSettables().setBlueGain(Math.max(0, pipelineSettings.cameraBlueGain));
} else {

View File

@@ -24,6 +24,7 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.photonvision.common.util.TestUtils;
import org.photonvision.vision.apriltag.AprilTagFamily;
import org.photonvision.vision.camera.QuirkyCamera;
import org.photonvision.vision.frame.provider.FileFrameProvider;
import org.photonvision.vision.pipeline.result.CVPipelineResult;
@@ -46,6 +47,7 @@ public class AprilTagTest {
pipeline.getSettings().cornerDetectionAccuracyPercentage = 4;
pipeline.getSettings().cornerDetectionUseConvexHulls = true;
pipeline.getSettings().targetModel = TargetModel.k200mmAprilTag;
pipeline.getSettings().tagFamily = AprilTagFamily.kTag36h11;
var frameProvider =
new FileFrameProvider(