Conversation
updates the limelighthelpers java class to latest version (v1.14) this requires LLOS 2026.0
There was a problem hiding this comment.
Pull request overview
Updates the in-repo LimelightHelpers utility to LimelightHelpers v1.14, aligning Spectrum’s vision integration with LLOS 2026.0+ and adding support for newer Limelight JSON/NetworkTables outputs.
Changes:
- Bumped LimelightHelpers header/version and expanded parsed JSON result models (e.g., hardware/IMU/rewind stats, additional timestamps, python output).
- Added new helper APIs for raw targets/corners, snapshots via NT, rewind control/capture, keystone setting, heartbeat, and USB port forwarding.
- Adjusted pose-estimate parsing behavior and introduced equality/hashCode implementations for some result types.
Comments suppressed due to low confidence (1)
src/main/java/frc/spectrumLib/vision/LimelightHelpers.java:1383
- The Javadocs for these deprecated methods were reduced to empty @param/@return tags, which removes useful guidance about replacement APIs and return format. Please restore meaningful parameter/return descriptions (or remove the empty tags) so the deprecation notice remains informative.
/**
* Switch to getBotPose
*
* @param limelightName
* @return
*/
@Deprecated
public static double[] getBotpose(String limelightName) {
return getLimelightNTDoubleArray(limelightName, "botpose");
}
/**
* Switch to getBotPose_wpiRed
*
* @param limelightName
* @return
*/
@Deprecated
public static double[] getBotpose_wpiRed(String limelightName) {
return getLimelightNTDoubleArray(limelightName, "botpose_wpired");
}
/**
* Switch to getBotPose_wpiBlue
*
* @param limelightName
* @return
*/
@Deprecated
public static double[] getBotpose_wpiBlue(String limelightName) {
return getLimelightNTDoubleArray(limelightName, "botpose_wpiblue");
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| && Arrays.equals(rawFiducials, that.rawFiducials); | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| int result = Objects.hash(pose, latency, tagCount, tagSpan, avgTagDist, avgTagArea); |
There was a problem hiding this comment.
PoseEstimate.equals()/hashCode() intentionally ignore timestampSeconds, but they also ignore isMegaTag2. That can make MegaTag1 and MegaTag2 estimates compare equal even when they represent different localization modes, and it also omits isMegaTag2 from the hash code. Consider including isMegaTag2 in equals/hashCode (or clearly documenting why it must be ignored).
| && Arrays.equals(rawFiducials, that.rawFiducials); | |
| } | |
| @Override | |
| public int hashCode() { | |
| int result = Objects.hash(pose, latency, tagCount, tagSpan, avgTagDist, avgTagArea); | |
| && Arrays.equals(rawFiducials, that.rawFiducials) | |
| && isMegaTag2 == that.isMegaTag2; | |
| } | |
| @Override | |
| public int hashCode() { | |
| int result = Objects.hash(pose, latency, tagCount, tagSpan, avgTagDist, avgTagArea, isMegaTag2); |
| * Configures the throttle value. Set to 100-200 while disabled to reduce thermal output/temperature. | ||
| * | ||
| * @param limelightName Name/identifier of the Limelight | ||
| * @param throttle Defaults to 0. Your Limelgiht will process one frame after skipping <throttle> frames. |
There was a problem hiding this comment.
Javadoc typo: "Limelgiht" should be "Limelight".
| * @param throttle Defaults to 0. Your Limelgiht will process one frame after skipping <throttle> frames. | |
| * @param throttle Defaults to 0. Your Limelight will process one frame after skipping <throttle> frames. |
| double counter = (currentArray.length > 0) ? currentArray[0] : 0; | ||
| double[] entries = new double[2]; | ||
| entries[0] = counter + 1; | ||
| entries[1] = Math.min(durationSeconds, 165); |
There was a problem hiding this comment.
triggerRewindCapture() clamps durationSeconds to a max of 165, but it allows negative values to be sent to NetworkTables. Please also clamp the lower bound (e.g., to 0) to avoid requesting a negative capture duration.
| entries[1] = Math.min(durationSeconds, 165); | |
| entries[1] = Math.max(0, Math.min(durationSeconds, 165)); |
| import frc.spectrumLib.vision.LimelightHelpers.LimelightResults; | ||
| import frc.spectrumLib.vision.LimelightHelpers.PoseEstimate; | ||
| import edu.wpi.first.math.geometry.Pose2d; | ||
| import edu.wpi.first.math.geometry.Pose3d; | ||
| import edu.wpi.first.math.geometry.Rotation2d; | ||
| import edu.wpi.first.math.geometry.Translation3d; | ||
| import edu.wpi.first.math.util.Units; | ||
| import edu.wpi.first.math.geometry.Rotation3d; | ||
| import edu.wpi.first.math.geometry.Translation2d; | ||
|
|
||
| import java.util.Objects; | ||
| import java.net.MalformedURLException; | ||
| import java.net.URL; | ||
| import java.util.Arrays; |
There was a problem hiding this comment.
The import list includes several unused or redundant imports (e.g., URL/MalformedURLException are no longer referenced, and importing LimelightHelpers.LimelightResults / PoseEstimate from the same compilation unit is unnecessary). If you have lint/format checks enabled, this can fail the build; please remove the unused/redundant imports and keep the import block minimal.
| public Pose3d getCameraPose_TargetSpace() | ||
| { | ||
| return toPose3D(cameraPose_TargetSpace); | ||
| } |
There was a problem hiding this comment.
Brace placement/indentation in this file has shifted away from the style used elsewhere in the codebase (e.g., methods place '{' on the next line). This makes the file inconsistent and harder to scan; please reformat to match the repository’s standard Java style (same-line braces, consistent indentation).
| /** | ||
| * T2D is an array that contains several targeting metrics | ||
| * | ||
| * T2D is an array that contains several targeting metrcis |
There was a problem hiding this comment.
Typo in Javadoc: "metrcis" should be "metrics".
| * T2D is an array that contains several targeting metrcis | |
| * T2D is an array that contains several targeting metrics |
| public static int getClassifierClassIndex (String limelightName) { | ||
| double[] t2d = getT2DArray(limelightName); | ||
| if(t2d.length == 17) | ||
| { | ||
| return (int)t2d[11]; | ||
| } | ||
| return 0; | ||
| } | ||
|
|
||
| /** | ||
| * Gets the detector class index from the primary result of the currently running neural | ||
| * detector pipeline. | ||
| * | ||
| * Gets the detector class index from the primary result of the currently running neural detector pipeline. | ||
| * @param limelightName Name of the Limelight camera | ||
| * @return Class index from detector pipeline | ||
| */ | ||
| public static int getDetectorClassIndex(String limelightName) { | ||
| double[] t2d = getT2DArray(limelightName); | ||
| if (t2d.length == 17) { | ||
| return (int) t2d[11]; | ||
| } | ||
| return 0; | ||
| public static int getDetectorClassIndex (String limelightName) { | ||
| double[] t2d = getT2DArray(limelightName); | ||
| if(t2d.length == 17) | ||
| { | ||
| return (int)t2d[10]; | ||
| } | ||
| return 0; |
There was a problem hiding this comment.
These methods have inconsistent spacing/indentation (extra space before '(', body not indented), which hurts readability and deviates from surrounding code style. Please reformat these methods to match the project’s standard Java formatting.
|
|
||
| static final String sanitizeName(String name) { | ||
| if (name == "" || name == null) { | ||
| if ("".equals(name) || name == null) { |
There was a problem hiding this comment.
Inefficient comparison to empty string, check for zero length instead.
| if ("".equals(name) || name == null) { | |
| if (name == null || name.isEmpty()) { |
updates the limelighthelpers java class to latest version (v1.14) this requires LLOS 2026.0