| 1 | package org.usfirst.frc.team3501.robot.commands.scaler; |
| 2 | |
| 3 | import org.usfirst.frc.team3501.robot.Robot; |
| 4 | |
| 5 | import edu.wpi.first.wpilibj.command.Command; |
| 6 | |
| 7 | /*** |
| 8 | * This command will run the winch motor continuously until the button |
| 9 | * tirggering it is released. |
| 10 | * |
| 11 | * pre-condition: This command must be run by a button in OI with method |
| 12 | * whileHeld(). The robot must be attached to the tower rung. |
| 13 | * |
| 14 | * post-condition: winch motor set to a specified speed. |
| 15 | * |
| 16 | * @author Lauren |
| 17 | * |
| 18 | */ |
| 19 | |
| 20 | public class RunWinchContinuous extends Command { |
| 21 | private double winchUpSpeed; |
| 22 | private int timeoutAmount; |
| 23 | |
| 24 | public RunWinchContinuous(double speed, int timeout) { |
| 25 | requires(Robot.scaler); |
| 26 | winchUpSpeed = speed; |
| 27 | timeoutAmount = timeout; |
| 28 | } |
| 29 | |
| 30 | @Override |
| 31 | protected void initialize() { |
| 32 | this.setTimeout(timeoutAmount); |
| 33 | Robot.scaler.runWinch(winchUpSpeed); |
| 34 | } |
| 35 | |
| 36 | @Override |
| 37 | protected void execute() { |
| 38 | } |
| 39 | |
| 40 | @Override |
| 41 | protected boolean isFinished() { |
| 42 | return this.isTimedOut(); |
| 43 | } |
| 44 | |
| 45 | @Override |
| 46 | protected void end() { |
| 47 | } |
| 48 | |
| 49 | @Override |
| 50 | protected void interrupted() { |
| 51 | end(); |
| 52 | } |
| 53 | } |