Skip to content

Commit ee003d8

Browse files
authored
Pull in a few older tweaks to LEDs
1 parent 8324a52 commit ee003d8

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

src/main/java/frc/robot/Robot.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -455,11 +455,12 @@ protected Command createRollerAnimationCommand() {
455455
"createRollerAnimation: algae=%b, coral=%b%n",
456456
algaeRoller.isRolling, coralRoller.isRolling);
457457
/*
458-
* On intake, one and only one is rolling
458+
* Both rollers run for intake and outtake now, so need to use motor direction
459+
* to determine intake vs. outtake
459460
*/
460461
BooleanSupplier intakeSupplier =
461462
() -> {
462-
return coralRoller.isRolling.getAsBoolean() ^ algaeRoller.isRolling.getAsBoolean();
463+
return coralRoller.getRollerVelocity() > 0 || algaeRoller.getRollerVelocity() > 0;
463464
};
464465

465466
/*
@@ -477,17 +478,13 @@ protected Command createRollerAnimationCommand() {
477478
return gamepiece == null ? Color.kYellow : gamepiece.color;
478479
}
479480
/*
480-
* Otherwise, use the color associated with the gripper's target piece.
481+
* Otherwise, use the color associated with the current control mode.
481482
*/
482-
else if (algaeRoller.isRolling.getAsBoolean()) {
483+
else if (algaeModeSupplier.getAsBoolean()) {
483484
return Gamepiece.ALGAE.color;
484-
} else if (coralRoller.isRolling.getAsBoolean()) {
485+
} else {
485486
return Gamepiece.CORAL.color;
486487
}
487-
/*
488-
* On some weird logic error, use red.
489-
*/
490-
return Color.kRed;
491488
};
492489

493490
return leds.createRollerAnimationCommand(intakeSupplier, colorSupplier);

src/main/java/frc/robot/elevator/AlgaeRoller.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class AlgaeRoller extends SubsystemBase {
2929

3030
private final RelativeEncoder encoder = leaderMotor.getEncoder();
3131
private final SparkLimitSwitch algaeSensor = leaderMotor.getForwardLimitSwitch();
32-
public Trigger hasAlgae = new Trigger(() -> algaeSensor.isPressed());
32+
public final Trigger hasAlgae = new Trigger(() -> algaeSensor.isPressed());
3333
public final Trigger isRolling = new Trigger(() -> Math.abs(encoder.getVelocity()) > 1);
3434

3535
public AlgaeRoller() {

src/main/java/frc/robot/elevator/CoralRoller.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class CoralRoller extends SubsystemBase {
2525
private final RelativeEncoder encoder = motor.getEncoder();
2626
private final SparkLimitSwitch coralSensor = motor.getForwardLimitSwitch();
2727
public final Trigger hasCoral = new Trigger(() -> coralSensor.isPressed());
28-
public final Trigger isRolling = new Trigger(() -> Math.abs(encoder.getVelocity()) > 1);
28+
public final Trigger isRolling = new Trigger(() -> Math.abs(getRollerVelocity()) > 1);
2929

3030
public CoralRoller() {
3131
// spotless:off

src/main/java/frc/robot/vision/Camera.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ private Camera(String name, Translation3d translation, Rotation3d rotation) {
4242
this.transform = new Transform3d(translation, rotation);
4343
this.device = new PhotonCamera(name);
4444

45+
// TODO: switch back to official field layout
4546
AprilTagFieldLayout tagLayout;
4647
try {
4748
tagLayout = new AprilTagFieldLayout(VisionConstants.kAprilTagLayoutPath);

0 commit comments

Comments
 (0)