Skip to content

Limelights

NextLimelight is a wrapper around the Limelight3A that initializes the device lazily from the hardware map, while creating many useful methods. Any data that is not wrapped can be accessed through camera.

// Using your configuration name
val limelight = NextLimelight("limelight")

Sets the poll rate and pipeline, then starts polling, all in one call.

limelight.startReading(pipeline = 0, hz = 100)

Returns the straight-line distance (hypotenuse) from the robot to the AprilTag for the matching id (or any visible tag if id is null), in the given unit or null if no valid tag is available.

val distance = limelight.getDistance(id = 7) //Defaults to Inches
if (distance != null) {
// ...
}

Returns the robot’s field position in FTC coordinates, or null if no valid pose is available.

val pose = limelight.getPose()
if (pose != null) {
// ...
}

Returns the robot’s field position in Pedro coordinates, or null if no valid pose is available.

val pose = limelight.getPedroPose()
if (pose != null) {
// ...
}