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

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Owen756 committed Sep 6, 2023
2 parents b04914f + 0d5e1bc commit 6f5df38
Showing 1 changed file with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import frc.robot.util.scheduling.LifecycleSubsystem;
import frc.robot.util.scheduling.SubsystemPriority;
import frc.robot.wrist.WristSubsystem;
import java.util.function.Supplier;

public class SuperstructureManager extends LifecycleSubsystem {
private SuperstructureMotionManager motionManager;
Expand Down Expand Up @@ -64,8 +65,12 @@ public Command setIntakeOverrideCommand(IntakeState intakeState) {
}

public Command setStateCommand(SuperstructureState newGoalState) {
return Commands.runOnce(() -> setGoal(newGoalState))
.andThen(Commands.waitUntil(() -> atGoal(newGoalState)));
return setStateCommand(() -> newGoalState);
}

public Command setStateCommand(Supplier<SuperstructureState> newGoalState) {
return Commands.runOnce(() -> setGoal(newGoalState.get()))
.andThen(Commands.waitUntil(() -> atGoal(newGoalState.get())));
}

public void setMode(HeldGamePiece mode) {
Expand All @@ -84,25 +89,23 @@ public HeldGamePiece getMode() {
}

public Command getIntakeFloorCommand() {
// TODO: Refactor to use setStateCommand, since this command never finishes atm
return Commands.run(
return setStateCommand(
() -> {
if (mode == HeldGamePiece.CONE) {
setGoal(States.INTAKING_CONE_FLOOR);
return States.INTAKING_CONE_FLOOR;
} else {
setGoal(States.INTAKING_CUBE_FLOOR);
return States.INTAKING_CUBE_FLOOR;
}
});
}

public Command getIntakeShelfCommand() {
// TODO: Refactor to use setStateCommand, since this command never finishes atm
return Commands.run(
return setStateCommand(
() -> {
if (mode == HeldGamePiece.CONE) {
setGoal(States.INTAKING_CONE_SHELF);
return States.INTAKING_CONE_SHELF;
} else {
setGoal(States.INTAKING_CUBE_SHELF);
return States.INTAKING_CUBE_SHELF;
}
});
}
Expand Down

0 comments on commit 6f5df38

Please sign in to comment.