Skip to content

Comments

bump LimelightHelpers to v1.14#45

Closed
Project516 wants to merge 3 commits intomainfrom
update-limelighthelpers
Closed

bump LimelightHelpers to v1.14#45
Project516 wants to merge 3 commits intomainfrom
update-limelighthelpers

Conversation

@Project516
Copy link
Contributor

updates the limelighthelpers java class to latest version (v1.14) this requires LLOS 2026.0

@Project516 Project516 requested a review from Copilot February 7, 2026 01:17
@Project516 Project516 self-assigned this Feb 7, 2026
@Project516 Project516 added dependencies Pull requests that update a dependency file java Pull requests that update java code labels Feb 7, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +788 to +793
&& Arrays.equals(rawFiducials, that.rawFiducials);
}

@Override
public int hashCode() {
int result = Objects.hash(pose, latency, tagCount, tagSpan, avgTagDist, avgTagArea);
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
&& 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);

Copilot uses AI. Check for mistakes.
* 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.
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Javadoc typo: "Limelgiht" should be "Limelight".

Suggested change
* @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.

Copilot uses AI. Check for mistakes.
double counter = (currentArray.length > 0) ? currentArray[0] : 0;
double[] entries = new double[2];
entries[0] = counter + 1;
entries[1] = Math.min(durationSeconds, 165);
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
entries[1] = Math.min(durationSeconds, 165);
entries[1] = Math.max(0, Math.min(durationSeconds, 165));

Copilot uses AI. Check for mistakes.
Comment on lines +10 to +23
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;
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +63 to 66
public Pose3d getCameraPose_TargetSpace()
{
return toPose3D(cameraPose_TargetSpace);
}
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
/**
* T2D is an array that contains several targeting metrics
*
* T2D is an array that contains several targeting metrcis
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in Javadoc: "metrcis" should be "metrics".

Suggested change
* T2D is an array that contains several targeting metrcis
* T2D is an array that contains several targeting metrics

Copilot uses AI. Check for mistakes.
Comment on lines +1266 to +1286
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;
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.

static final String sanitizeName(String name) {
if (name == "" || name == null) {
if ("".equals(name) || name == null) {
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inefficient comparison to empty string, check for zero length instead.

Suggested change
if ("".equals(name) || name == null) {
if (name == null || name.isEmpty()) {

Copilot uses AI. Check for mistakes.
@Project516 Project516 closed this Feb 11, 2026
@Project516 Project516 deleted the update-limelighthelpers branch February 11, 2026 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file java Pull requests that update java code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant