diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 42d7e0a..203d5f7 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -70,9 +70,13 @@ public class RobotContainer { m_driverController.povRight().onTrue(new SetDeflectorCommand(turretSubsystem, Constants.ShooterConstants.DEFLECTOR_SET_ANGLE3)); m_driverController.povUp().onTrue(new SetDeflectorCommand(turretSubsystem, Constants.ShooterConstants.DEFLECTOR_SET_ANGLE2)); - m_driverController.y().onTrue(intakeSubsystem.deployCommand()); + /*m_driverController.y().onTrue(intakeSubsystem.deployCommand()); m_driverController.a().onTrue(intakeSubsystem.retractCommand()); - m_driverController.b().onTrue(intakeSubsystem.reverseCommand()); + m_driverController.b().onTrue(intakeSubsystem.reverseCommand());*/ + + m_driverController.x().onTrue(intakeSubsystem.killSpeedCommand()); + m_driverController.a().onTrue(intakeSubsystem.startSpeedCommand()); + m_driverController.b().onTrue(intakeSubsystem.revSpeedCommand()); } /** diff --git a/src/main/java/frc/robot/commands/ManualIntake.java b/src/main/java/frc/robot/commands/ManualIntake.java new file mode 100644 index 0000000..3ba0dbb --- /dev/null +++ b/src/main/java/frc/robot/commands/ManualIntake.java @@ -0,0 +1,62 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +package frc.robot.commands; + +import frc.robot.subsystems.IntakeSubsystem; + +import javax.lang.model.util.ElementScanner14; + +import edu.wpi.first.wpilibj.XboxController; +import edu.wpi.first.wpilibj2.command.Command; + +/** An example command that uses an example subsystem. */ +public class ManualIntake extends Command { + @SuppressWarnings({"PMD.UnusedPrivateField", "PMD.SingularField"}) + private final IntakeSubsystem m_subsystem; + private final XboxController m_XboxController; + + /** + * Creates a new ExampleCommand. + * + * @param subsystem The subsystem used by this command. + */ + public ManualIntake(IntakeSubsystem subsystem, XboxController xboxController) { + m_subsystem = subsystem; + m_XboxController = xboxController; + // Use addRequirements() here to declare subsystem dependencies. + addRequirements(subsystem); + } + + // Called when the command is initially scheduled. + @Override + public void initialize() {} + + // Called every time the scheduler runs while the command is scheduled. + @Override + public void execute() { + if(m_XboxController.getRightBumper()==true) + { + m_subsystem.extend(); + } + else if(m_XboxController.getLeftBumper()==true) + { + m_subsystem.retract(); + } + else + { + m_subsystem.neutral(); + } + } + + // Called once the command ends or is interrupted. + @Override + public void end(boolean interrupted) {} + + // Returns true when the command should end. + @Override + public boolean isFinished() { + return false; + } +} diff --git a/src/main/java/frc/robot/subsystems/IntakeSubsystem.java b/src/main/java/frc/robot/subsystems/IntakeSubsystem.java index d0e5eb0..6ec7f39 100644 --- a/src/main/java/frc/robot/subsystems/IntakeSubsystem.java +++ b/src/main/java/frc/robot/subsystems/IntakeSubsystem.java @@ -69,12 +69,12 @@ public class IntakeSubsystem extends TestableSubsystem { public Command deployCommand() { - return new FunctionalCommand(this::extend, this::extend, interrupted -> neutral(), this::isDeployed, this).andThen(Commands.startEnd(() -> setSpeed(50), () -> setSpeed(0), this)); + return new FunctionalCommand(this::extend, this::extend, interrupted -> neutral(), this::isDeployed, this).andThen(Commands.startEnd(() -> setSpeed(.5), () -> setSpeed(0), this)); } public Command reverseCommand() { - return new FunctionalCommand(this::extend, this::extend, interrupted -> neutral(), this::isDeployed, this).andThen(Commands.startEnd(() -> setSpeed(-50), () -> setSpeed(0), this)); + return new FunctionalCommand(this::extend, this::extend, interrupted -> neutral(), this::isDeployed, this).andThen(Commands.startEnd(() -> setSpeed(-.5), () -> setSpeed(0), this)); } public Command retractCommand() @@ -82,6 +82,21 @@ public class IntakeSubsystem extends TestableSubsystem { return this.runOnce(() -> setSpeed(0)).andThen(new FunctionalCommand(this::retract, this::retract, interrupted -> neutral(), this::isRetracted, this)); } + public Command startSpeedCommand() + { + return this.runOnce(() -> setSpeed(.5)); + } + + public Command killSpeedCommand() + { + return this.runOnce(() -> setSpeed(0)); + } + + public Command revSpeedCommand() + { + return this.runOnce(() -> setSpeed(-.5)); + } + @PostTest(name = "A friendly name", enabled = true) public void myFailingPostTest(){ assertThat(true).isFalse();