add stopWinch() method to Scaler to use in RunWinchContinuous
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / commands / RunWinchContinuous.java
1 package org.usfirst.frc.team3501.robot.commands;
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
23 public RunWinchContinuous(double speed) {
24 requires(Robot.scaler);
25 winchUpSpeed = speed;
26 }
27
28 @Override
29 protected void initialize() {
30 Robot.scaler.runWinch(winchUpSpeed);
31 }
32
33 @Override
34 protected void execute() {
35 }
36
37 @Override
38 protected boolean isFinished() {
39 return true;
40 }
41
42 @Override
43 protected void end() {
44 Robot.scaler.stopWinch();
45 }
46
47 @Override
48 protected void interrupted() {
49 end();
50 }
51 }