Limelight
Package: limelight
Limelight is the entry point for the library — one instance per physical camera, bound to that camera's NetworkTables table (/<name>). Construction verifies the table exists (except in simulation) and creates the associated LimelightData and LimelightSettings objects.
Constructor
Limelight(String name)name
NetworkTables name of the camera, e.g. "limelight" or "limelight-front"
Fields
limelightName
String
Name passed to the constructor.
Methods
getSettings()
LimelightSettings
Chainable object for .withXXXX() configuration calls. See LimelightSettings.
getData()
LimelightData
Read-only NetworkTables data: raw fiducials, raw detections, barcodes, Python I/O. See LimelightData.
createPoseEstimator(EstimationMode)
LimelightPoseEstimator
Creates a MegaTag1 or MegaTag2 pose estimator bound to this camera. See LimelightPoseEstimator.
getLatestResults()
Optional<LimelightResults>
Parses the latest limelight.results JSON blob. Empty if the Limelight isn't publishing JSON over NT. See LimelightResults.
getNTTable()
NetworkTable
The underlying NetworkTable for this camera.
flush()
void
Flushes the default NetworkTableInstance immediately.
rewindCapture(double durationSeconds)
void
Triggers a rewind buffer capture (max 165s, rate-limited on the Limelight). Requires supported hardware.
snapshot(String snapshotname)
void
Asynchronously requests an HTTP snapshot capture (capturesnapshot) named snapshotname.
static isAvailable(String limelightName)
boolean
Polls NetworkTables (up to 2s) for a getpipe key under the given table name. Raises a WPILib Alert and returns false if not found.
static setupPortForwardingUSB(int usbIndex)
void
Forwards ports 5800-5809 + usbIndex*10 to 172.29.<usbIndex>.1:5800-5809 for USB-connected LL3A/3G web UI access.
Notes
isAvailableis meant to run once, at robot construction — not in a periodic loop. UsegetData().targetData.getTargetStatus()for per-iteration 2D target validity, orPoseEstimate.hasDatafor 3D pose validity.snapshot()runs the HTTP request on a separate thread viaCompletableFutureso it never blocks the robot loop.
See Also
Last updated
Was this helpful?