Commit | Line | Data |
---|---|---|
cef820ab | 1 | package org.usfirst.frc.team3501.robot.commands.scaler; |
0d4d5dcb LM |
2 | |
3 | import org.usfirst.frc.team3501.robot.Robot; | |
4 | ||
5 | import 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 | 20 | public class RunWinchContinuous extends Command { |
a7160a69 | 21 | private double winchUpSpeed; |
43abf0e4 | 22 | private int timeoutAmount; |
0d4d5dcb | 23 | |
43abf0e4 | 24 | public RunWinchContinuous(double speed, int timeout) { |
0ecbf4af | 25 | requires(Robot.scaler); |
0d4d5dcb | 26 | winchUpSpeed = speed; |
43abf0e4 | 27 | timeoutAmount = timeout; |
0d4d5dcb LM |
28 | } |
29 | ||
30 | @Override | |
31 | protected void initialize() { | |
43abf0e4 | 32 | this.setTimeout(timeoutAmount); |
0d4d5dcb LM |
33 | Robot.scaler.runWinch(winchUpSpeed); |
34 | } | |
35 | ||
36 | @Override | |
37 | protected void execute() { | |
38 | } | |
39 | ||
40 | @Override | |
41 | protected boolean isFinished() { | |
43abf0e4 | 42 | return this.isTimedOut(); |
0d4d5dcb LM |
43 | } |
44 | ||
45 | @Override | |
46 | protected void end() { | |
47 | } | |
48 | ||
49 | @Override | |
50 | protected void interrupted() { | |
a7160a69 | 51 | end(); |
0d4d5dcb LM |
52 | } |
53 | } |