-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
factored out amp preparation sequence
- Loading branch information
1 parent
bf3e5f4
commit 7d88dc2
Showing
2 changed files
with
42 additions
and
13 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
36 changes: 36 additions & 0 deletions
36
src/main/java/frc/robot/commands/sequences/PrepareAmpSequence.java
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package frc.robot.commands.sequences; | ||
|
||
import edu.wpi.first.wpilibj2.command.Commands; | ||
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; | ||
import frc.robot.commands.elevator.ElevatorToAmpCommand; | ||
import frc.robot.commands.intake.pivot.IntakePivotSetPositionCommand; | ||
import frc.robot.commands.intake.roller.IntakeRollerOuttakeCommand; | ||
import frc.robot.subsystems.elevator.ElevatorSubsystem; | ||
import frc.robot.subsystems.intake.IntakePivotSubsystem; | ||
import frc.robot.subsystems.intake.IntakeRollerSubsystem; | ||
|
||
/** | ||
* Deploys the intake, rolls the note to its amping position, then raises the elevator to amp height while putting the | ||
* intake at amping angle. Given that a note is already in the robot, this sequence prepares the mechanisms to deposit | ||
* it into the amp. | ||
*/ | ||
public class PrepareAmpSequence extends SequentialCommandGroup { | ||
|
||
/** Constructs a new {@link PrepareAmpSequence}. */ | ||
public PrepareAmpSequence(ElevatorSubsystem elevatorSubsystem, | ||
IntakePivotSubsystem intakePivotSubsystem, | ||
IntakeRollerSubsystem intakeRollerSubsystem) { | ||
|
||
this.addCommands( | ||
new IntakePivotSetPositionCommand(intakePivotSubsystem, 1) // extend pivot | ||
.unless(() -> !intakeRollerSubsystem.getRockwellSensorValue()), | ||
new IntakeRollerOuttakeCommand(intakeRollerSubsystem, .17, .75) // run rollers to front sensor | ||
.unless(intakeRollerSubsystem::getAmpSensor) | ||
.until(() -> intakeRollerSubsystem.getFrontSensorReached()), | ||
Commands.parallel( | ||
new IntakePivotSetPositionCommand(intakePivotSubsystem, 0.2), // angle intake for scoring | ||
new ElevatorToAmpCommand(elevatorSubsystem) // raise elevator | ||
) // These commands can run at the same time to save time. | ||
); | ||
} | ||
} |