Conversation
There was a problem hiding this comment.
Pull request overview
Updates vendored FRC libraries to newer 2026 versions to keep this codebase compatible with updated vendor APIs and features.
Changes:
- Bump PlayingWithFusion vendordep from
2026.3.05to2026.3.28. - Update
LimelightHelpersto v1.14, adding new JSON/NT fields and helper APIs (rewind, raw targets, USB port forwarding, etc.). - Update Elasticlib header/docs references and copyright year to 2026.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
vendordeps/playingwithfusion2026.json |
Updates PlayingWithFusion vendordep version strings to 2026.3.28. |
src/main/java/org/carlmontrobotics/lib199/vendorLibs/LimelightHelpers.java |
Updates LimelightHelpers to v1.14 with new result structures and NT helper methods; modifies pose-estimate behavior. |
src/main/java/org/carlmontrobotics/lib199/vendorLibs/Elastic.java |
Updates header comment/docs links and copyright year. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| gyroZ = data[4]; | ||
| gyroX = data[5]; | ||
| gyroY = data[6]; | ||
| accelZ = data[7]; | ||
| accelX = data[8]; | ||
| accelY = data[9]; |
There was a problem hiding this comment.
IMUResults.parseDataArray() appears to map gyro axes inconsistently with IMUData in this same file. IMUData treats indices 4/5/6 as gyroX/gyroY/gyroZ, but parseDataArray() assigns index 4 to gyroZ, 5 to gyroX, and 6 to gyroY, which will swap axes in parsed JSON results. Align the index mapping (or document the different ordering if the JSON imu.data format is intentionally different).
| gyroZ = data[4]; | |
| gyroX = data[5]; | |
| gyroY = data[6]; | |
| accelZ = data[7]; | |
| accelX = data[8]; | |
| accelY = data[9]; | |
| gyroX = data[4]; | |
| gyroY = data[5]; | |
| gyroZ = data[6]; | |
| accelX = data[7]; | |
| accelY = data[8]; | |
| accelZ = data[9]; |
| if (poseArray.length == 0) { | ||
| // Handle the case where no data is available | ||
| return null; // or some default PoseEstimate | ||
| return new PoseEstimate(); | ||
| } |
There was a problem hiding this comment.
getBotPoseEstimate(...) now returns a default new PoseEstimate() when the NT pose array is empty. This changes the “no data available” signal from null to a pose at the origin with timestamp/latency 0, which can cause callers to accidentally treat it as a real measurement and inject a bad vision update. Consider restoring the previous behavior (return null) or adding an explicit validity flag in PoseEstimate and returning an invalid instance that callers can reliably detect (and updating public helpers to use that).
| * @param durationSeconds Duration of rewind capture in seconds (max 165) | ||
| */ | ||
| public static void triggerRewindCapture(String limelightName, double durationSeconds) { | ||
| double[] currentArray = getLimelightNTDoubleArray(limelightName, "capture_rewind"); | ||
| 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 the duration to a max of 165s, but it does not prevent negative durations. A negative durationSeconds will be sent to the Limelight, which is unlikely to be valid. Clamp the value to a valid range (e.g., 0–165) before writing the NT array.
| * @param durationSeconds Duration of rewind capture in seconds (max 165) | |
| */ | |
| public static void triggerRewindCapture(String limelightName, double durationSeconds) { | |
| double[] currentArray = getLimelightNTDoubleArray(limelightName, "capture_rewind"); | |
| double counter = (currentArray.length > 0) ? currentArray[0] : 0; | |
| double[] entries = new double[2]; | |
| entries[0] = counter + 1; | |
| entries[1] = Math.min(durationSeconds, 165); | |
| * @param durationSeconds Duration of rewind capture in seconds (clamped to 0-165) | |
| */ | |
| public static void triggerRewindCapture(String limelightName, double durationSeconds) { | |
| double[] currentArray = getLimelightNTDoubleArray(limelightName, "capture_rewind"); | |
| double counter = (currentArray.length > 0) ? currentArray[0] : 0; | |
| double[] entries = new double[2]; | |
| entries[0] = counter + 1; | |
| entries[1] = Math.max(0, Math.min(durationSeconds, 165)); |
| * | ||
| * @param usbIndex The USB index of the Limelight (0, 1, 2, etc.) | ||
| */ | ||
| public static void setupPortForwardingUSB(int usbIndex) { |
There was a problem hiding this comment.
setupPortForwardingUSB(int usbIndex) accepts any integer, but the method documentation implies non-negative indices (0, 1, 2, ...). Passing a negative index produces an invalid IP/port range (e.g., 172.29.-1.1). Add input validation (and ideally fail fast with an IllegalArgumentException) to prevent misconfiguration.
| public static void setupPortForwardingUSB(int usbIndex) { | |
| public static void setupPortForwardingUSB(int usbIndex) { | |
| if (usbIndex < 0) { | |
| throw new IllegalArgumentException("usbIndex must be non-negative: " + usbIndex); | |
| } |
| import org.carlmontrobotics.lib199.vendorLibs.LimelightHelpers.LimelightResults; | ||
| import org.carlmontrobotics.lib199.vendorLibs.LimelightHelpers.PoseEstimate; |
There was a problem hiding this comment.
The file imports nested types from the class being declared (LimelightHelpers.LimelightResults / LimelightHelpers.PoseEstimate). These imports are unnecessary here because the nested types are already in scope inside LimelightHelpers, and they can also trigger unused-import lint failures. Remove these two imports and refer to the nested types directly.
| import org.carlmontrobotics.lib199.vendorLibs.LimelightHelpers.LimelightResults; | |
| import org.carlmontrobotics.lib199.vendorLibs.LimelightHelpers.PoseEstimate; |
| import java.net.MalformedURLException; | ||
| import java.net.URL; |
There was a problem hiding this comment.
java.net.MalformedURLException and java.net.URL are imported but no longer used after removing the HTTP snapshot code. Unused imports can fail builds when lint/format checks are enabled; please remove them.
| import java.net.MalformedURLException; | |
| import java.net.URL; |
update: