| 1 | package org.usfirst.frc.team3501.robot.commands.shooter; |
| 2 | |
| 3 | import org.usfirst.frc.team3501.robot.Robot; |
| 4 | import org.usfirst.frc.team3501.robot.subsystems.Shooter; |
| 5 | |
| 6 | import edu.wpi.first.wpilibj.command.Command; |
| 7 | |
| 8 | /** |
| 9 | * This command reverses the index wheel continuously when OI button managing |
| 10 | * index wheel is pressed. The command will run the index wheel motor until the |
| 11 | * button triggering it is released. |
| 12 | * |
| 13 | * Should only be run from the operator interface. |
| 14 | * |
| 15 | * pre-condition: This command must be run by a button in OI with |
| 16 | * button.whileHeld(...). |
| 17 | * |
| 18 | * @author Rohan |
| 19 | */ |
| 20 | public class ReverseIndexWheelContinuous extends Command { |
| 21 | private Shooter shooter = Robot.getShooter(); |
| 22 | |
| 23 | /** |
| 24 | * See JavaDoc comment in class for details |
| 25 | * |
| 26 | * @param motorVal |
| 27 | * value range from -1 to 1 |
| 28 | */ |
| 29 | public ReverseIndexWheelContinuous() { |
| 30 | requires(shooter); |
| 31 | } |
| 32 | |
| 33 | // Called just before this Command runs the first time |
| 34 | @Override |
| 35 | protected void initialize() { |
| 36 | } |
| 37 | |
| 38 | // Called repeatedly when this Command is scheduled to run |
| 39 | @Override |
| 40 | protected void execute() { |
| 41 | shooter.setIndexWheelMotorVal(shooter.DEFAULT_INDEXING_SPEED * -1); |
| 42 | } |
| 43 | |
| 44 | // Called once after isFinished returns true |
| 45 | @Override |
| 46 | protected void end() { |
| 47 | shooter.stopIndexWheel(); |
| 48 | } |
| 49 | |
| 50 | // Called when another command which requires one or more of the same |
| 51 | // subsystems is scheduled to run |
| 52 | @Override |
| 53 | protected void interrupted() { |
| 54 | end(); |
| 55 | } |
| 56 | |
| 57 | @Override |
| 58 | protected boolean isFinished() { |
| 59 | return false; |
| 60 | |
| 61 | } |
| 62 | |
| 63 | } |