For the complete documentation index, see llms.txt. This page is also available as Markdown.

Basic Setup

This tutorial creates a Limelight, configures it, and reads its 2D target data: the minimum setup for any pipeline type.

1. Install YALL

See How do I install YALL? if you haven't added the vendordep yet.

2. Create the Limelight object

Create one Limelight per physical camera, named after its NetworkTables table (the name shown in the Limelight web UI, usually limelight):

import limelight.Limelight;

Limelight limelight = new Limelight("limelight");

Construction checks that the camera's NT table exists (skipped in simulation) and raises a WPILib Alert if it doesn't. Do this once, in your subsystem constructor, not in periodic().

3. Configure it

getSettings() returns a chainable configuration object. Every .withXXXX() call applies immediately and returns this:

import limelight.networktables.LimelightSettings.LEDMode;
import edu.wpi.first.math.geometry.Pose3d;

limelight.getSettings()
         .withLimelightLEDMode(LEDMode.PipelineControl)
         .withCameraOffset(Pose3d.kZero)
         .save();

withCameraOffset sets where the camera physically sits relative to robot center. Get this right, since MegaTag pose estimation is only as accurate as this offset. See LimelightSettings & Pipelines for the full option list.

4. Read 2D target data

For simple aiming (turn-to-target, distance-to-target), getData().targetData gives you crosshair-relative offsets without any pose estimation:

Always check getTargetStatus() before trusting tx/ty, since they hold stale values when no target is visible.

Next steps

Last updated

Was this helpful?