Improve command decorator names (#1945)

This commit is contained in:
Oblarg
2019-10-19 11:13:33 -04:00
committed by Peter Johnson
parent a38f183a98
commit 53816155ba
18 changed files with 47 additions and 46 deletions

View File

@@ -50,7 +50,7 @@ public class RobotContainer {
// speed)
.withTimeout(kAutoTimeoutSeconds)
// When the command ends, turn off the shooter and the feeder
.whenFinished(() -> {
.andThen(() -> {
m_shooter.disable();
m_shooter.stopFeeder();
});

View File

@@ -52,7 +52,8 @@ public class RobotContainer {
// Reset the encoders before starting
.beforeStarting(m_robotDrive::resetEncoders)
// End the command when the robot's driven distance exceeds the desired value
.interruptOn(() -> m_robotDrive.getAverageEncoderDistance() >= kAutoDriveDistanceInches);
.withInterrupt(() -> m_robotDrive.getAverageEncoderDistance()
>= kAutoDriveDistanceInches);
// A complex auto routine that drives forward, drops a hatch, and then drives backward.
private final Command m_complexAuto = new ComplexAutoCommand(m_robotDrive, m_hatchSubsystem);
@@ -78,7 +79,7 @@ public class RobotContainer {
new RunCommand(() -> m_robotDrive.arcadeDrive(
m_driverController.getY(GenericHID.Hand.kLeft),
m_driverController.getX(GenericHID.Hand.kRight)),
m_robotDrive)
m_robotDrive)
);
// Add commands to the autonomous command chooser

View File

@@ -40,7 +40,7 @@ public class ComplexAutoCommand extends SequentialCommandGroup {
// Reset the encoders before starting
.beforeStarting(driveSubsystem::resetEncoders)
// End the command when the robot's driven distance exceeds the desired value
.interruptOn(
.withInterrupt(
() -> driveSubsystem.getAverageEncoderDistance() >= kAutoDriveDistanceInches),
// Release the hatch
@@ -53,7 +53,7 @@ public class ComplexAutoCommand extends SequentialCommandGroup {
driveSubsystem
)
.beforeStarting(driveSubsystem::resetEncoders)
.interruptOn(
.withInterrupt(
() -> driveSubsystem.getAverageEncoderDistance() <= -kAutoBackupDistanceInches)
);
}