Skip to content

Update#129

Merged
timtogan merged 2 commits intomasterfrom
update
Apr 15, 2026
Merged

Update#129
timtogan merged 2 commits intomasterfrom
update

Conversation

@timtogan
Copy link
Copy Markdown
Member

update:

  • Elasticlib to 2026
  • LimelightHelpers to v1.14
  • playingwithfusion 2026.3.28

@timtogan timtogan requested a review from a team as a code owner April 15, 2026 00:18
Copilot AI review requested due to automatic review settings April 15, 2026 00:18
Copy link
Copy Markdown
Contributor

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 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.05 to 2026.3.28.
  • Update LimelightHelpers to 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.

Comment on lines +426 to +431
gyroZ = data[4];
gyroX = data[5];
gyroY = data[6];
accelZ = data[7];
accelX = data[8];
accelY = data[9];
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

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

Suggested change
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];

Copilot uses AI. Check for mistakes.
Comment on lines 922 to 925
if (poseArray.length == 0) {
// Handle the case where no data is available
return null; // or some default PoseEstimate
return new PoseEstimate();
}
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

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

Copilot uses AI. Check for mistakes.
Comment on lines +1881 to +1888
* @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);
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

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.

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

Copilot uses AI. Check for mistakes.
*
* @param usbIndex The USB index of the Limelight (0, 1, 2, etc.)
*/
public static void setupPortForwardingUSB(int usbIndex) {
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
public static void setupPortForwardingUSB(int usbIndex) {
public static void setupPortForwardingUSB(int usbIndex) {
if (usbIndex < 0) {
throw new IllegalArgumentException("usbIndex must be non-negative: " + usbIndex);
}

Copilot uses AI. Check for mistakes.
Comment on lines +14 to +15
import org.carlmontrobotics.lib199.vendorLibs.LimelightHelpers.LimelightResults;
import org.carlmontrobotics.lib199.vendorLibs.LimelightHelpers.PoseEstimate;
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
import org.carlmontrobotics.lib199.vendorLibs.LimelightHelpers.LimelightResults;
import org.carlmontrobotics.lib199.vendorLibs.LimelightHelpers.PoseEstimate;

Copilot uses AI. Check for mistakes.
Comment on lines 24 to 25
import java.net.MalformedURLException;
import java.net.URL;
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
import java.net.MalformedURLException;
import java.net.URL;

Copilot uses AI. Check for mistakes.
@timtogan timtogan merged commit 23e3a1c into master Apr 15, 2026
7 checks passed
@timtogan timtogan deleted the update branch April 15, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants