mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-24 01:31:44 +00:00
Add 36h11 tag model for 2024 (#951)
* Add 36h11 model * Formatting fixes * Match frontend TargetModel enum with backend * fix target model merge * Update TargetModel.java --------- Co-authored-by: Sriman Achanta <68172138+srimanachanta@users.noreply.github.com>
This commit is contained in:
@@ -31,6 +31,7 @@ import java.util.List;
|
||||
import org.photonvision.common.configuration.ConfigManager;
|
||||
import org.photonvision.common.util.math.MathUtils;
|
||||
import org.photonvision.targeting.MultiTargetPNPResults;
|
||||
import org.photonvision.vision.apriltag.AprilTagFamily;
|
||||
import org.photonvision.vision.frame.Frame;
|
||||
import org.photonvision.vision.frame.FrameThresholdType;
|
||||
import org.photonvision.vision.pipe.CVPipe.CVPipeResult;
|
||||
@@ -69,27 +70,15 @@ public class AprilTagPipeline extends CVPipeline<CVPipelineResult, AprilTagPipel
|
||||
// Sanitize thread count - not supported to have fewer than 1 threads
|
||||
settings.threads = Math.max(1, settings.threads);
|
||||
|
||||
// if (cameraQuirks.hasQuirk(CameraQuirk.PiCam) && LibCameraJNI.isSupported()) {
|
||||
// // TODO: Picam grayscale
|
||||
// LibCameraJNI.setRotation(settings.inputImageRotationMode.value);
|
||||
// // LibCameraJNI.setShouldCopyColor(true); // need the color image to grayscale
|
||||
// }
|
||||
|
||||
// TODO (HACK): tag width is Fun because it really belongs in the "target model"
|
||||
// We need the tag width for the JNI to figure out target pose, but we need a
|
||||
// target model for the draw 3d targets pipeline to work...
|
||||
|
||||
// for now, hard code tag width based on enum value
|
||||
double tagWidth = Units.inchesToMeters(3 * 2); // for 6in 16h5 tag.
|
||||
|
||||
// AprilTagDetectorParams aprilTagDetectionParams =
|
||||
// new AprilTagDetectorParams(
|
||||
// settings.tagFamily,
|
||||
// settings.decimate,
|
||||
// settings.blur,
|
||||
// settings.threads,
|
||||
// settings.debug,
|
||||
// settings.refineEdges);
|
||||
double tagWidth;
|
||||
if (settings.tagFamily == AprilTagFamily.kTag36h11) {
|
||||
// 2024 tag, guess 6.5in
|
||||
tagWidth = Units.inchesToMeters(6.5);
|
||||
} else {
|
||||
// 2023/other: best guess is 6in
|
||||
tagWidth = Units.inchesToMeters(6);
|
||||
}
|
||||
|
||||
var config = new AprilTagDetector.Config();
|
||||
config.numThreads = settings.threads;
|
||||
|
||||
@@ -121,7 +121,22 @@ public enum TargetModel implements Releasable {
|
||||
new Point3(-Units.inchesToMeters(3), Units.inchesToMeters(3), 0),
|
||||
new Point3(-Units.inchesToMeters(3), -Units.inchesToMeters(3), 0),
|
||||
new Point3(Units.inchesToMeters(3), -Units.inchesToMeters(3), 0)),
|
||||
Units.inchesToMeters(3 * 2));
|
||||
Units.inchesToMeters(3 * 2)),
|
||||
// 2024 FRC tag. 6.5in inner tag, 8.125 overall
|
||||
kAruco6p5in_36h11(
|
||||
List.of(
|
||||
new Point3(Units.inchesToMeters(6.5 / 2.0), Units.inchesToMeters(6.5 / 2.0), 0),
|
||||
new Point3(Units.inchesToMeters(6.5 / 2.0), -Units.inchesToMeters(6.5 / 2.0), 0),
|
||||
new Point3(-Units.inchesToMeters(6.5 / 2.0), -Units.inchesToMeters(6.5 / 2.0), 0),
|
||||
new Point3(Units.inchesToMeters(6.5 / 2.0), -Units.inchesToMeters(6.5 / 2.0), 0)),
|
||||
Units.inchesToMeters(6.5)),
|
||||
k6p5in_36h11(
|
||||
List.of(
|
||||
new Point3(-Units.inchesToMeters(6.5 / 2.0), Units.inchesToMeters(6.5 / 2.0), 0),
|
||||
new Point3(Units.inchesToMeters(6.5 / 2.0), Units.inchesToMeters(6.5 / 2.0), 0),
|
||||
new Point3(Units.inchesToMeters(6.5 / 2.0), -Units.inchesToMeters(6.5 / 2.0), 0),
|
||||
new Point3(-Units.inchesToMeters(6.5 / 2.0), -Units.inchesToMeters(6.5 / 2.0), 0)),
|
||||
Units.inchesToMeters(6.5));
|
||||
|
||||
@JsonIgnore private MatOfPoint3f realWorldTargetCoordinates;
|
||||
@JsonIgnore private final MatOfPoint3f visualizationBoxBottom = new MatOfPoint3f();
|
||||
|
||||
Reference in New Issue
Block a user