Snapshot and capture
triggerSnapshot
Triggers a snapshot by incrementing the snapshot counter in NetworkTables. The Limelight rate-limits snapshot captures to once per 10 frames.
Name of the Limelight NetworkTables table.
setRewindEnabled
Enables or pauses the rewind buffer recording. When enabled, the camera continuously records frames to a rolling buffer.
Name of the Limelight NetworkTables table.
true to enable rewind recording, false to pause it.triggerRewindCapture
Triggers a rewind capture of the specified duration. The maximum duration is 165 seconds; values above this are clamped. The Limelight rate-limits this operation internally.
Name of the Limelight NetworkTables table.
Duration of the rewind capture in seconds. Clamped to a maximum of
165.0.Pose conversion
These static utility methods convert between the 6-elementdouble[] format used by NetworkTables and WPILib geometry types. The array format is always [x, y, z, roll, pitch, yaw] where translations are in meters and angles are in degrees.
toPose3D
Converts a 6-element pose array to a Pose3d object.
6-element array
[x, y, z, roll, pitch, yaw]. Angles must be in degrees.A
Pose3d with translation in meters and rotation in radians (converted internally). Returns an empty Pose3d if the array has fewer than 6 elements.toPose2D
Converts a 6-element pose array to a Pose2d object. Only x, y, and yaw are used; z, roll, and pitch are ignored.
6-element array
[x, y, z, roll, pitch, yaw]. Angles must be in degrees.A
Pose2d using x, y, and yaw (converted to radians). Returns an empty Pose2d if the array has fewer than 6 elements.pose3dToArray
Converts a Pose3d object to a 6-element array. This is the inverse of toPose3D.
The
Pose3d to convert.6-element array
[x, y, z, roll, pitch, yaw]. Translations are in meters; rotations are in degrees.pose2dToArray
Converts a Pose2d object to a 6-element array. z, roll, and pitch are always 0. This is the inverse of toPose2D.
The
Pose2d to convert.6-element array
[x, y, 0, 0, 0, yaw]. Translations are in meters; yaw is in degrees.Round-trip pattern
Usepose3dToArray and toPose3D (or their 2D equivalents) when storing or transmitting poses through NT or logging pipelines that require the flat array format:
Debugging
printPoseEstimate
Prints detailed information about a PoseEstimate to standard output. Useful for quick field-side debugging.
Output includes: timestamp (s), latency (ms), tag count, tag span (m), average tag distance (m), average tag area (%), isMegaTag2 flag, and per-fiducial details (ID, txnc, tync, ta, distance to camera/robot, ambiguity).
pose is null, prints "No PoseEstimate available." and returns immediately.
The
PoseEstimate to print. Safe to call with null.validPoseEstimate
Returns true if the PoseEstimate is non-null and contains at least one fiducial result. Use this before passing an estimate to the WPILib pose estimator.
The
PoseEstimate to validate.true if pose is non-null and pose.rawFiducials is non-empty. false otherwise.Network and connection
getHeartbeat
Returns a counter that increments once per frame. If this value stops changing, the camera is likely disconnected or has stopped publishing.
Name of the Limelight NetworkTables table.
Monotonically increasing frame counter. Verify the camera is alive by checking that this value changes between periodic cycles.
setupPortForwardingUSB
Sets up PortForwarder entries so a USB-connected Limelight 3A or 3G is reachable from the driver station or development machine.
Call this method once in robotInit(). Do not call it in a periodic loop.
| USB index | Forwarded ports | Limelight IP |
|---|---|---|
| 0 | 5800–5809 | 172.29.0.1 |
| 1 | 5810–5819 | 172.29.1.1 |
| 2 | 5820–5829 | 172.29.2.1 |
roboRIO-<team>-FRC.local:5801 (index 0) or roboRIO-<team>-FRC.local:5811 (index 1).
Zero-based index of the USB-connected Limelight.
0 forwards ports 5800–5809 to 172.29.0.1; 1 forwards ports 5810–5819 to 172.29.1.1, and so on.Flush
Calls NetworkTableInstance.getDefault().flush() to immediately push pending NT writes to the network. Used internally by SetRobotOrientation to ensure the orientation value reaches the camera before the next pose read.
SetRobotOrientation_NoFlush when you want to control flush timing yourself.
IMU
getIMUData
Returns the current IMU data from the Limelight as an IMUData object. Returns an all-zeros object if the data is unavailable or the raw array has fewer than 10 elements.
IMUData fields map to the raw NT array as follows:
| Field | Array index |
|---|---|
robotYaw | 0 |
Roll | 1 |
Pitch | 2 |
Yaw | 3 |
gyroX | 4 |
gyroY | 5 |
gyroZ | 6 |
accelX | 7 |
accelY | 8 |
accelZ | 9 |
Name of the Limelight NetworkTables table.
IMUData object populated from the imu NetworkTables array. All fields are 0.0 if data is unavailable.