rename SetWinchSpeed to RunWinchContinuous and add new condition to end() to stop...
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / commands / RunWinchContinuous.java
CommitLineData
0d4d5dcb
LM
1package org.usfirst.frc.team3501.robot.commands;
2
3import org.usfirst.frc.team3501.robot.Robot;
4
5import edu.wpi.first.wpilibj.command.Command;
6
5a3fcb1c 7/***
a7160a69
LM
8 * This command will run the winch motor continuously until the button
9 * tirggering it is released.
5a3fcb1c
LM
10 *
11 * pre-condition: This command must be run by a button in OI with method
a7160a69 12 * whileHeld(). The robot must be attached to the tower rung.
5a3fcb1c
LM
13 *
14 * post-condition: winch motor set to a specified speed.
15 *
d4649cd7 16 * @author Lauren
5a3fcb1c
LM
17 *
18 */
19
a7160a69
LM
20public class RunWinchContinuous extends Command {
21 private final double STOP_SPEED = 0.0;
22 private double winchUpSpeed;
0d4d5dcb 23
a7160a69 24 public RunWinchContinuous(double speed) {
0ecbf4af 25 requires(Robot.scaler);
0d4d5dcb 26 winchUpSpeed = speed;
0d4d5dcb
LM
27 }
28
29 @Override
30 protected void initialize() {
31 Robot.scaler.runWinch(winchUpSpeed);
32 }
33
34 @Override
35 protected void execute() {
36 }
37
38 @Override
39 protected boolean isFinished() {
40 return true;
41 }
42
43 @Override
44 protected void end() {
a7160a69 45 Robot.scaler.runWinch(STOP_SPEED);
0d4d5dcb
LM
46 }
47
48 @Override
49 protected void interrupted() {
a7160a69 50 end();
0d4d5dcb
LM
51 }
52}