Configure vision, read AprilTag results, and use camera data safely in robot code.
The Limelight 3A is a USB vision camera with its own processor and browser-based configuration interface. It can run AprilTag, color, barcode, and neural-network pipelines. It does not have built-in LED illumination; check the camera image and exposure settings for your lighting conditions.
FTC teams can use its target measurements for alignment or use its AprilTag localization output as one input to autonomous navigation. Camera results are measurements, not a complete robot-control system.
For FTC, connect the Limelight 3A to the Control Hub with a USB-C-to-USB-A cable in the blue USB 3.0 port.
http://limelight.local:5801 or through Limelight Hardware Manager.limelight.hardwareMap. The 3A uses USB-C and has no RJ45 port.The Limelight gives your robot important information such as:
Your robot can use this to turn, drive, or align automatically.
This LinearOpMode example polls the camera and reports valid target measurements. Set the pipeline index to the pipeline configured in the Limelight web interface.
import com.qualcomm.hardware.limelightvision.LLResult;
import com.qualcomm.hardware.limelightvision.Limelight3A;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
@TeleOp(name = "Limelight Check")
public class LimelightCheck extends LinearOpMode {
@Override
public void runOpMode() throws InterruptedException {
Limelight3A limelight = hardwareMap.get(Limelight3A.class, "limelight");
limelight.setPollRateHz(100);
limelight.pipelineSwitch(0);
limelight.start();
telemetry.addLine("Limelight ready");
telemetry.update();
waitForStart();
while (opModeIsActive()) {
LLResult result = limelight.getLatestResult();
if (result != null && result.isValid()) {
telemetry.addData("tx (degrees)", result.getTx());
telemetry.addData("ty (degrees)", result.getTy());
telemetry.addData("ta (percent)", result.getTa());
} else {
telemetry.addLine("No valid target");
}
telemetry.update();
}
limelight.stop();
}
}
The Limelight 3A can detect AprilTags automatically. This helps your robot:
AprilTag detections are returned as a list. Check the configured pipeline and use the actual tag IDs for your field/game, rather than assuming IDs 1, 2, and 3.
import com.qualcomm.hardware.limelightvision.LLResultTypes;
import java.util.List;
List<LLResultTypes.FiducialResult> tags = result.getFiducialResults();
for (LLResultTypes.FiducialResult tag : tags) {
telemetry.addData("AprilTag ID", tag.getFiducialId());
telemetry.addData("Tag tx", tag.getTargetXDegrees());
telemetry.addData("Tag ty", tag.getTargetYDegrees());
}
For field localization, enable Full 3D in the AprilTag pipeline and configure the camera's position relative to the robot. MegaTag 2 also requires current robot yaw to be sent to Limelight before reading its pose.
// Send the robot's current heading in degrees before reading MegaTag 2 pose.
limelight.updateRobotOrientation(robotYawDegrees);
LLResult result = limelight.getLatestResult();
if (result != null && result.isValid()) {
Pose3D fieldPose = result.getBotpose_MT2();
if (fieldPose != null) {
telemetry.addData("Field pose", fieldPose);
}
}
Do not combine this pose with your autonomous localizer until you have checked coordinate frames, camera mounting, heading conventions, and latency against known field positions.