LimeModule

class LimeModule(val name: String) : Camera

The LimeModule class represents a Limelight camera with NetworkTables integration.

Provides access to Limelight data including target detection, pose estimation, and camera configuration via NetworkTables. Implements the Camera interface for unified vision system integration.

Usage Example:

val limelight = LimeModule("limelight")

limelight.configure {
ledMode = LimeModule.LEDMode.OFF
camMode = LimeModule.CamMode.VISION
pipeline = 0
}

// Get latest measurement
val measurement = limelight.getLatestMeasurement()
measurement?.let { swerveDrive.addVisionMeasurement(it.pose, it.timestampSeconds, it.stdDevs) }

Constructors

Link copied to clipboard
constructor(name: String)

Types

Link copied to clipboard

Camera operating modes for Limelight.

Link copied to clipboard
data class Config(var ledMode: LimeModule.LEDMode = LEDMode.PIPELINE, var camMode: LimeModule.CamMode = CamMode.VISION, var pipeline: Int = 0, var stream: LimeModule.StreamMode = StreamMode.STANDARD)

Configuration for the Limelight.

Link copied to clipboard

LED operating modes for Limelight.

Link copied to clipboard

Streaming modes for multiple Limelights.

Properties

Link copied to clipboard
open override val name: String

The name of the Limelight in NetworkTables (e.g., "limelight").

Functions

Link copied to clipboard
fun configure(block: LimeModule.Config.() -> Unit)

Configures the Limelight using a DSL-style configuration block.

Link copied to clipboard

Gets all unprocessed vision measurements since the last call.

Link copied to clipboard

Gets the ID of the primary AprilTag in view.

Link copied to clipboard
fun getBotPose(): Pose2d?

Gets the robot's 2D pose in field space using MegaTag (botpose).

Link copied to clipboard
fun getBotPose3d(): Pose3d?

Gets the robot's 3D pose in field space using MegaTag (botpose).

Link copied to clipboard
fun getBotPoseBlue(): Pose2d?

Gets the robot's 2D pose in field space using MegaTag with blue alliance origin.

Link copied to clipboard
fun getBotPoseRed(): Pose2d?

Gets the robot's 2D pose in field space using MegaTag with red alliance origin.

Link copied to clipboard
fun getCameraPose(): Transform3d?

Gets the camera's 3D pose in robot space.

Link copied to clipboard
open override fun getDistanceToTag(tagId: Int?): Distance?

Gets the distance to a tag.

Link copied to clipboard

Gets the total latency in seconds (for use with pose estimators).

Link copied to clipboard

Gets the total latency (pipeline + capture) in milliseconds.

Link copied to clipboard

Gets the pipeline's latency contribution in milliseconds.

Link copied to clipboard
open override fun getLatestMeasurement(referencePose: Pose2d?): VisionMeasurement?

Gets the latest vision measurement from the camera.

Link copied to clipboard
fun getTa(): Double

Gets the target area as a percentage of the image.

Link copied to clipboard
open override fun getTargetHorizontalOffset(): Angle?

Gets the horizontal offset to the currently tracked target.

Link copied to clipboard
fun getTargetPoseCameraSpace(): Transform3d?

Gets the target's 3D pose in camera space.

Link copied to clipboard
fun getTargetPoseRobotSpace(): Transform3d?

Gets the target's 3D pose in robot space.

Link copied to clipboard
open override fun getTargetVerticalOffset(): Angle?

Gets the vertical offset to the currently tracked target.

Link copied to clipboard
fun getTs(): Double

Gets the target skew or rotation in degrees.

Link copied to clipboard
fun getTx(): Double

Gets the horizontal offset from crosshair to target in degrees.

Link copied to clipboard
fun getTy(): Double

Gets the vertical offset from crosshair to target in degrees.

Link copied to clipboard
open override fun hasTarget(): Boolean

Checks if the camera currently sees any valid targets.

Link copied to clipboard

Sets the camera operating mode.

Link copied to clipboard

Sets the LED operating mode.

Link copied to clipboard
fun setPipeline(pipeline: Int)

Sets the active vision pipeline.

Link copied to clipboard

Sets the streaming mode.

Link copied to clipboard

Takes a snapshot with the current settings.