63ff149f7d09538480796a16f793023763fb4bd8
[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 final double STOP_SPEED = 0.0;
22 private double winchUpSpeed;
23
24 public RunWinchContinuous(double speed) {
25 requires(Robot.scaler);
26 winchUpSpeed = speed;
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() {
45 Robot.scaler.runWinch(STOP_SPEED);
46 }
47
48 @Override
49 protected void interrupted() {
50 end();
51 }
52 }