-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e2d68d2
commit 9df4054
Showing
5 changed files
with
132 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,92 @@ | ||
package frc.robot.robot_manager; | ||
|
||
import java.util.List; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import edu.wpi.first.wpilibj2.command.Commands; | ||
import edu.wpi.first.wpilibj2.command.Subsystem; | ||
import java.util.List; | ||
|
||
public class RobotCommands { | ||
private final RobotManager robot; | ||
private final RobotManager robot; | ||
private final Subsystem[] requirements; | ||
|
||
public RobotCommands(RobotManager robot) { | ||
this.robot = robot; | ||
var requirementsList = | ||
List.of( | ||
robot.arm, | ||
robot.intake, | ||
robot.queuer, | ||
robot.shooter); | ||
var requirementsList = List.of(robot.arm, robot.intake, robot.queuer, robot.shooter); | ||
requirements = requirementsList.toArray(Subsystem[]::new); | ||
} | ||
|
||
public Command intakeCommand() { | ||
return Commands.runOnce(robot::intakeRequest, requirements).andThen(robot.waitForState(RobotState.IDLE_WITH_GP)); | ||
return Commands.runOnce(robot::intakeRequest, requirements) | ||
.andThen(robot.waitForState(RobotState.IDLE_WITH_GP)); | ||
} | ||
public Command outtakeCommand(){ | ||
return Commands.runOnce(robot::outtakeRequest, requirements).andThen(robot.waitForState(RobotState.IDLE_NO_GP)); | ||
|
||
public Command outtakeCommand() { | ||
return Commands.runOnce(robot::outtakeRequest, requirements) | ||
.andThen(robot.waitForState(RobotState.IDLE_NO_GP)); | ||
} | ||
public Command speakerCommand(){ | ||
return Commands.runOnce(robot::prepareSpeakerRequest, requirements).andThen(robot.waitForState(RobotState.IDLE_NO_GP)); | ||
|
||
public Command speakerCommand() { | ||
return Commands.runOnce(robot::prepareSpeakerRequest, requirements) | ||
.andThen(robot.waitForState(RobotState.IDLE_NO_GP)); | ||
} | ||
public Command passCommand(){ | ||
return Commands.runOnce(robot::preparePassRequest,requirements).andThen(robot.waitForState(RobotState.IDLE_NO_GP)); | ||
|
||
public Command passCommand() { | ||
return Commands.runOnce(robot::preparePassRequest, requirements) | ||
.andThen(robot.waitForState(RobotState.IDLE_NO_GP)); | ||
} | ||
|
||
public Command stowCommand(){ | ||
return Commands.runOnce(robot::stowRequest,requirements).andThen(robot.waitForState(RobotState.IDLE_NO_GP)); | ||
public Command stowCommand() { | ||
return Commands.runOnce(robot::stowRequest, requirements) | ||
.andThen(robot.waitForState(RobotState.IDLE_NO_GP)); | ||
} | ||
public Command idleWithGpCommand(){ | ||
return Commands.runOnce(robot::idleWithGpRequest,requirements).andThen(robot.waitForState(RobotState.IDLE_WITH_GP)); | ||
|
||
public Command idleWithGpCommand() { | ||
return Commands.runOnce(robot::idleWithGpRequest, requirements) | ||
.andThen(robot.waitForState(RobotState.IDLE_WITH_GP)); | ||
} | ||
public Command stopIntakingCommand(){ | ||
return Commands.runOnce(robot::stopIntakingRequest,requirements).andThen(robot.waitForState(RobotState.IDLE_NO_GP)); | ||
|
||
public Command stopIntakingCommand() { | ||
return Commands.runOnce(robot::stopIntakingRequest, requirements) | ||
.andThen(robot.waitForState(RobotState.IDLE_NO_GP)); | ||
} | ||
|
||
public Command waitSubwooferCommand(){ | ||
return Commands.runOnce(robot::waitSubwooferRequest,requirements).andThen(robot.waitForState(RobotState.IDLE_NO_GP)); | ||
|
||
public Command waitSubwooferCommand() { | ||
return Commands.runOnce(robot::waitSubwooferRequest, requirements) | ||
.andThen(robot.waitForState(RobotState.IDLE_NO_GP)); | ||
} | ||
public Command waitAmpCommand(){ | ||
return Commands.runOnce(robot::waitAmpRequest,requirements).andThen(robot.waitForState(RobotState.IDLE_NO_GP)); | ||
|
||
public Command waitAmpCommand() { | ||
return Commands.runOnce(robot::waitAmpRequest, requirements) | ||
.andThen(robot.waitForState(RobotState.IDLE_NO_GP)); | ||
} | ||
public Command waitSpeakerCommand(){ | ||
return Commands.runOnce(robot::waitSpeakerRequest,requirements).andThen(robot.waitForState(RobotState.IDLE_NO_GP)); | ||
|
||
public Command waitSpeakerCommand() { | ||
return Commands.runOnce(robot::waitSpeakerRequest, requirements) | ||
.andThen(robot.waitForState(RobotState.IDLE_NO_GP)); | ||
} | ||
public Command confirmShotCommand(){ | ||
return Commands.runOnce(robot::confirmShotRequest,requirements).andThen(robot.waitForState(RobotState.IDLE_NO_GP)); | ||
|
||
public Command confirmShotCommand() { | ||
return Commands.runOnce(robot::confirmShotRequest, requirements) | ||
.andThen(robot.waitForState(RobotState.IDLE_NO_GP)); | ||
} | ||
public Command ampCommand(){ | ||
return Commands.runOnce(robot::prepareAmpRequest,requirements).andThen(robot.waitForState(RobotState.IDLE_NO_GP)); | ||
|
||
public Command ampCommand() { | ||
return Commands.runOnce(robot::prepareAmpRequest, requirements) | ||
.andThen(robot.waitForState(RobotState.IDLE_NO_GP)); | ||
} | ||
public Command stopShootingCommand(){ | ||
return Commands.runOnce(robot::stopShootingRequest,requirements).andThen(robot.waitForState(RobotState.IDLE_WITH_GP)); | ||
|
||
public Command stopShootingCommand() { | ||
return Commands.runOnce(robot::stopShootingRequest, requirements) | ||
.andThen(robot.waitForState(RobotState.IDLE_WITH_GP)); | ||
} | ||
public Command feedingCommand(){ | ||
return Commands.runOnce(robot::prepareFeedRequest, requirements).andThen(robot.waitForState(RobotState.IDLE_NO_GP)); | ||
|
||
public Command feedingCommand() { | ||
return Commands.runOnce(robot::prepareFeedRequest, requirements) | ||
.andThen(robot.waitForState(RobotState.IDLE_NO_GP)); | ||
} | ||
public Command subwooferCommand(){ | ||
return Commands.runOnce(robot::prepareSubwooferRequest, requirements).andThen(robot.waitForState(RobotState.IDLE_NO_GP)); | ||
|
||
public Command subwooferCommand() { | ||
return Commands.runOnce(robot::prepareSubwooferRequest, requirements) | ||
.andThen(robot.waitForState(RobotState.IDLE_NO_GP)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters