Object Detection
This tutorial reads neural classifier results, the pipeline type used for game-piece detection (e.g. spotting a piece on the field before intaking it).
1. Switch to a classifier or detector pipeline
Configure the correct pipeline index in the Limelight web UI, or switch it from code:
limelight.getSettings().withPipelineIndex(1).save();2. Read results from the JSON payload
getLatestResults() returns the full frame, including whichever target arrays are populated for the active pipeline:
limelight.getLatestResults().ifPresent((LimelightResults result) -> {
for (NeuralClassifier object : result.targets_Classifier) {
if (object.className.equals("algae") && object.confidence > 0.7) {
// valid detection: object.tx / object.ty give position in the image
}
}
});targets_Classifier is empty unless the active pipeline is a neural classifier pipeline. Check result.pipeline_type if you're unsure which pipeline produced a frame.
3. Neural Detector: bounding boxes instead of whole-frame labels
If your pipeline is a detector (bounding boxes) rather than a classifier (whole-frame/zone label), read targets_Detector instead. It's the same LimelightResults object, just a different array:
4. Faster path: raw detections without JSON parsing
If you only need position and don't need className/confidence, LimelightData.getRawDetections() decodes the rawdetections NetworkTables entry directly, including the four bounding-box corners, which the JSON NeuralDetector result doesn't expose:
Next steps
Target & Pipeline Types: every target type and what pipeline produces it.
Results JSON vs. Raw NetworkTables: when to use
getLatestResults()vs. the raw accessors.Tuning a Neural Network Pipeline: confidence threshold and crop window.
Last updated
Was this helpful?