Skip to content

Vision comms LED state, disable unused triggers, and cleanup#458

Closed
phurley67 wants to merge 2 commits into
mainfrom
455-led-cleanup
Closed

Vision comms LED state, disable unused triggers, and cleanup#458
phurley67 wants to merge 2 commits into
mainfrom
455-led-cleanup

Conversation

@phurley67

Copy link
Copy Markdown
Contributor

Closes #455

Summary

  • Add VISION_COMMS_NO_POSE LED state (blinking yellow) for Mac alive but no tags
  • Add LED trigger for vision comms state while disabled
  • Comment out hood stowed trigger
  • Comment out middle canned shot binding
  • Remove stale commented-out dpad_down debug code
  • Delete unused TestSubsytem.java

Split from #337. Depends on #456 for vision.isCommsAlive().

Test plan

  • Verify blinking yellow LEDs when Mac is alive but no tags visible
  • Confirm solid red LEDs when Mac is disconnected
  • Verify no regressions from commented-out triggers

🤖 Generated with Claude Code

- Add VISION_COMMS_NO_POSE LED state (blinking yellow) for Mac alive but no tags
- Add LED trigger for vision comms state while disabled
- Comment out hood stowed trigger
- Comment out middle canned shot binding
- Remove stale commented-out dpad_down debug code
- Delete unused TestSubsytem.java

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 19, 2026 22:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new LED state to distinguish “vision comms alive but no pose/tags” from “vision comms down,” and cleans up unused/commented bindings and dead code.

Changes:

  • Introduce VISION_COMMS_NO_POSE LED state (blinking yellow) and add a disabled-mode trigger to enable it.
  • Disable/comment out unused triggers/bindings and remove stale commented debug code.
  • Delete unused TestSubsytem.java.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/main/java/frc/util/TestSubsytem.java Removes an unused subsystem implementation.
src/main/java/frc/robot/RobotContainer.java Adds new LED behavior + trigger; comments out unused bindings/triggers.
src/main/java/frc/robot/constants/LEDConstants.java Adds new LED enum state for the comms-alive/no-pose condition.

// Blinking YELLOW (this trigger) = Mac is alive, just no tags
// Default pattern = Everything working fine
new Trigger(new LEDBooleanSupplier(() -> DriverStation.isDisabled()
&& vision.isCommsAlive()

Copilot AI Mar 19, 2026

Copy link

Choose a reason for hiding this comment

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

PhotonVision currently does not define isCommsAlive() (only getMacMiniConnection() exists), so this new trigger will not compile on this branch. Either add isCommsAlive() to PhotonVision in this PR, or switch this call to an existing API and update the logic accordingly (or ensure this PR is merged only after the dependency that introduces the method).

Suggested change
&& vision.isCommsAlive()
&& vision.getMacMiniConnection()

Copilot uses AI. Check for mistakes.
@@ -253,6 +253,17 @@ private void configureLeds() {
// Turn off the "vision bad" LED state once the drivetrain has moved away from the origin, indicating we likely have a valid pose estimate.
new Trigger(new LEDBooleanSupplier(() -> (DriverStation.isDisabled() && drivetrain.getPose().getTranslation().getDistance(new Translation2d()) < 0.1))).whileTrue(leds.enableState(LED_STATES.VISION_BAD.id()));

Copilot AI Mar 19, 2026

Copy link

Choose a reason for hiding this comment

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

As written, VISION_BAD is enabled whenever disabled + pose is near the origin, regardless of whether vision comms are alive. This conflicts with the new semantics described below (solid red = comms down) and will also be true at the same time as VISION_COMMS_NO_POSE when comms are alive. Consider gating VISION_BAD with a comms-down check (e.g., !vision.isCommsAlive() once available) so the states are mutually exclusive and the LED meanings match the comments.

Suggested change
new Trigger(new LEDBooleanSupplier(() -> (DriverStation.isDisabled() && drivetrain.getPose().getTranslation().getDistance(new Translation2d()) < 0.1))).whileTrue(leds.enableState(LED_STATES.VISION_BAD.id()));
new Trigger(new LEDBooleanSupplier(() -> (DriverStation.isDisabled()
&& !vision.isCommsAlive()
&& drivetrain.getPose().getTranslation().getDistance(new Translation2d()) < 0.1)))
.whileTrue(leds.enableState(LED_STATES.VISION_BAD.id()));

Copilot uses AI. Check for mistakes.
Comment on lines +256 to +265
// Show blinking yellow while disabled when the Mac Mini is sending
// heartbeats (comms alive) but no pose data is available (no tags
// visible). This helps the drive team distinguish:
// Solid RED (VISION_BAD) = Mac is dead or comms down
// Blinking YELLOW (this trigger) = Mac is alive, just no tags
// Default pattern = Everything working fine
new Trigger(new LEDBooleanSupplier(() -> DriverStation.isDisabled()
&& vision.isCommsAlive()
&& drivetrain.getPose().getTranslation().getDistance(new Translation2d()) < 0.1))
.whileTrue(leds.enableState(LED_STATES.VISION_COMMS_NO_POSE.id()));

Copilot AI Mar 19, 2026

Copy link

Choose a reason for hiding this comment

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

VISION_COMMS_NO_POSE will be enabled at the same time as VISION_BAD with the current triggers. Because LEDSubsystem.applyLEDS() applies higher state IDs first and lower IDs last (higher priority), VISION_BAD (lower ordinal) will override this new blinking-yellow state, so the yellow may never be visible. Ensure the triggers are mutually exclusive (or adjust state priority/IDs) so the intended indication can actually display.

Copilot uses AI. Check for mistakes.
Comment on lines +19 to +23
// VISION_COMMS_NO_POSE: Mac Mini is alive and sending heartbeats,
// but no AprilTags are visible. Shows blinking yellow on the
// underglow while disabled so the driver knows "comms good, just
// no tags" vs "everything is broken" (VISION_BAD = solid red).
VISION_COMMS_NO_POSE,

Copilot AI Mar 19, 2026

Copy link

Choose a reason for hiding this comment

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

LED_STATES.id() returns ordinal(), so inserting VISION_COMMS_NO_POSE here shifts the numeric IDs (and therefore priority ordering) of every state after it. If anything external (Shuffleboard arrays, logs, PathPlanner events, driver expectations) relies on stable state IDs or priority, this is brittle. Consider assigning explicit fixed IDs (or appending new states at the end and documenting the priority scheme).

Copilot uses AI. Check for mistakes.
The VISION_COMMS_NO_POSE trigger depends on vision.isCommsAlive()
which is added in #453 (networking-vision). Commented out with a
TODO to uncomment after that PR lands.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Vilok1 Vilok1 closed this Apr 2, 2026
@Vilok1 Vilok1 deleted the 455-led-cleanup branch April 2, 2026 14:48
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.

Vision comms LED state, disable unused triggers, and cleanup

3 participants