Skip to content
This repository has been archived by the owner on Apr 20, 2024. It is now read-only.

Commit

Permalink
Zero gyro in do nothing auto
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanjcoderman committed Apr 18, 2024
1 parent 22c5509 commit 8d9e5df
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/main/java/frc/robot/autos/AutoChooser.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@
public class AutoChooser {
private final SendableChooser<AutoSelection> chooser = new SendableChooser<>();
private final Set<String> brokenAutoNames = new HashSet<>();
private final Command doNothingAuto;
private Optional<Command> cachedCommand = Optional.empty();
private String cachedAutoName = "";

public AutoChooser() {
public AutoChooser(AutoCommands commands) {
SmartDashboard.putData("Autos/SelectedAuto", chooser);
chooser.setDefaultOption(AutoSelection.DO_NOTHING.toString(), AutoSelection.DO_NOTHING);

for (AutoSelection selection : EnumSet.allOf(AutoSelection.class)) {
chooser.addOption(selection.toString(), selection);
}

this.doNothingAuto = commands.doNothingCommand();
}

public Command getAutoCommand() {
Expand All @@ -54,8 +57,8 @@ public Command getAutoCommand() {
}

if (autoName.equals("")) {
var command = Commands.print("No auto path provided, doing nothing");
cachedCommand = Optional.of(command);
var command = Commands.print("No auto path provided, running do nothing auto");
cachedCommand = Optional.of(command.andThen(doNothingAuto));
return command;
}

Expand Down
4 changes: 4 additions & 0 deletions src/main/java/frc/robot/autos/AutoCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ public AutoCommands(RobotCommands actions, RobotManager robotManager) {
this.robotManager = robotManager;
}

public Command doNothingCommand() {
return robotManager.localization.getZeroCommand();
}

public Command speakerSnapCommand() {
return actions.waitForSpeakerShotCommand();
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/autos/Autos.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public Autos(

PPHolonomicDriveController.setRotationTargetOverride(this::getRotationTargetOverride);

autoChooser = new AutoChooser();
autoChooser = new AutoChooser(autoCommands);

FollowPathCommand.warmupCommand().schedule();
PathfindingCommand.warmupCommand().schedule();
Expand Down

0 comments on commit 8d9e5df

Please sign in to comment.