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