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.
Creating a NextLimelight
Section titled “Creating a NextLimelight”// Using your configuration nameval limelight = NextLimelight("limelight")// Using your configuration nameNextLimelight limelight = new NextLimelight("limelight");startReading(pipeline, hz)
Section titled “startReading(pipeline, hz)”Sets the poll rate and pipeline, then starts polling, all in one call.
limelight.startReading(pipeline = 0, hz = 100)limelight.startReading(0, 100);getDistance(unit, id)
Section titled “getDistance(unit, id)”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 Inchesif (distance != null) { // ...}Distance distance = limelight.getDistance(Inches.INSTANCE, 7); //Defaults to Inchesif (distance != null) { // ...}getPose()
Section titled “getPose()”Returns the robot’s field position in FTC coordinates, or null if no valid pose is available.
val pose = limelight.getPose()if (pose != null) { // ...}Pose2d pose = limelight.getPose();if (pose != null) { // ...}getPedroPose()
Section titled “getPedroPose()”Returns the robot’s field position in Pedro coordinates, or null if no valid pose is available.
val pose = limelight.getPedroPose()if (pose != null) { // ...}Pose2d pose = limelight.getPedroPose();if (pose != null) { // ...}
