Skip to content

Commit b91070c

Browse files
AutoAlgaeHeights Working
1 parent 49cb5bc commit b91070c

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

src/main/java/frc/robot/Controls.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public class Controls {
6161

6262
private BranchHeight branchHeight = BranchHeight.CORAL_LEVEL_FOUR;
6363
private ScoringMode scoringMode = ScoringMode.CORAL;
64-
private ScoringMode intakeMode = ScoringMode.CORAL;
64+
public ScoringMode intakeMode = ScoringMode.CORAL;
6565
private SoloScoringMode soloScoringMode = SoloScoringMode.NO_GAME_PIECE;
6666
private AlgaeIntakeHeight algaeIntakeHeight = AlgaeIntakeHeight.ALGAE_LEVEL_THREE_FOUR;
6767

@@ -950,7 +950,7 @@ private void configureSoloControllerBindings() {
950950
.alongWith(scoringModeSelectRumble())
951951
.withName("Algae Scoring Mode"),
952952
AutoAlgaeHeights.autoAlgaeIntakeCommand(
953-
s.drivebaseSubsystem, superStructure)
953+
s.drivebaseSubsystem, superStructure, this)
954954
.until(() -> sensors.armSensor.booleanInClaw()));
955955
}
956956
default -> scoreCommand = Commands.none();
@@ -997,8 +997,9 @@ private void configureSoloControllerBindings() {
997997
soloController
998998
.leftBumper()
999999
.onTrue(
1000-
superStructure
1001-
.quickGroundIntake(soloController.povUp())
1000+
Commands.parallel(
1001+
Commands.runOnce(() -> intakeMode = ScoringMode.CORAL),
1002+
superStructure.quickGroundIntake(soloController.povUp()))
10021003
.withName("Quick Gound intake"));
10031004
// Scoring levels coral and algae intake heights
10041005
soloController

src/main/java/frc/robot/subsystems/auto/AutoAlgaeHeights.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
import edu.wpi.first.wpilibj.DriverStation;
77
import edu.wpi.first.wpilibj.DriverStation.Alliance;
88
import edu.wpi.first.wpilibj2.command.Command;
9+
import frc.robot.Controls;
910
import frc.robot.subsystems.SuperStructure;
1011
import frc.robot.subsystems.drivebase.CommandSwerveDrivetrain;
12+
import frc.robot.util.ScoringMode;
1113
import java.util.List;
1214

1315
/**
@@ -18,6 +20,7 @@ public class AutoAlgaeHeights extends Command {
1820

1921
private final CommandSwerveDrivetrain drivebase;
2022
private final SuperStructure s;
23+
private final Controls c;
2124

2225
private static final AprilTagFieldLayout aprilTagFieldLayout =
2326
AprilTagFieldLayout.loadField(AprilTagFields.k2025ReefscapeWelded);
@@ -40,14 +43,15 @@ public class AutoAlgaeHeights extends Command {
4043
aprilTagFieldLayout.getTagPose(9).get().toPose2d(),
4144
aprilTagFieldLayout.getTagPose(11).get().toPose2d());
4245

43-
public AutoAlgaeHeights(CommandSwerveDrivetrain drivebase, SuperStructure s) {
46+
public AutoAlgaeHeights(CommandSwerveDrivetrain drivebase, SuperStructure s, Controls c) {
4447
this.drivebase = drivebase;
4548
this.s = s;
49+
this.c = c;
4650
}
4751

4852
public static Command autoAlgaeIntakeCommand(
49-
CommandSwerveDrivetrain drivebase, SuperStructure s) {
50-
return new AutoAlgaeHeights(drivebase, s);
53+
CommandSwerveDrivetrain drivebase, SuperStructure s, Controls c) {
54+
return new AutoAlgaeHeights(drivebase, s, c);
5155
}
5256

5357
private static boolean isBlue() {
@@ -95,6 +99,6 @@ public void execute() {
9599

96100
@Override
97101
public boolean isFinished() {
98-
return false;
102+
return c.intakeMode != ScoringMode.ALGAE;
99103
}
100104
}

0 commit comments

Comments
 (0)