public class AprilTagIdentification {
AprilTagProcessor aprilTagProcessor;
VisionPortal visionPortal;
public int detectionId = 0;
public double robotPose_x = 0.0;
public double robotPose_y = 0.0;
public double bearingAngle = 0.0;
public boolean locTagFound = false;
public void init(HardwareMap hwdmap, MultipleTelemetry telemetrys) {
// build processor and portal here
}
}
if (!nearBasket) {
currentId = artifactControl.getCurrentTag();
if (currentId != 0) {
switch (currentId) {
case 21: currentPattern = ObeliskPattern.GPP; break;
case 22: currentPattern = ObeliskPattern.PGP; break;
case 23: currentPattern = ObeliskPattern.PPG; break;
}
patternFound = true;
}
}
ArtifactControl, read tag pose only in trusted windows:if (aprilTagIdentification.locTagFound) {
calculatedRobotPose_X = aprilTagIdentification.robotPose_x;
calculatedRobotPose_Y = aprilTagIdentification.robotPose_y;
robotAngleAprilTag = aprilTagIdentification.bearingAngle;
gyroscope.resetHeading();
gyroscope.setAngleOffset(36.5 - robotAngleAprilTag);
drive.setPose(new Pose(
calculatedRobotPose_X,
calculatedRobotPose_Y,
Math.toRadians(126.5 - robotAngleAprilTag)
));
}
telemetrys.addData("[Artifact] AprilTag Robot Pose X", artifactControl.calculatedRobotPose_X);
telemetrys.addData("[Artifact] AprilTag Robot Pose Y", artifactControl.calculatedRobotPose_Y);
telemetrys.addData("[Artifact] AprilTag Robot Angle", artifactControl.robotAngleAprilTag);
telemetrys.addData("[->] Pattern", artifactControl.artifactPattern);
AprilTag Implementation