Commit | Line | Data |
---|---|---|
9738295a SG |
1 | package org.usfirst.frc.team3501.robot.commands.climber; |
2 | ||
a04ce2ff SG |
3 | import org.usfirst.frc.team3501.robot.Robot; |
4 | ||
9738295a SG |
5 | import edu.wpi.first.wpilibj.command.Command; |
6 | ||
7 | /** | |
de8c65d3 | 8 | * This command will run the winch motor continuously until the button |
e2e9a7a7 SG |
9 | * triggering it is released. |
10 | * | |
11 | * pre-condition: This command must be run by a button in OI. The robot must be | |
12 | * attached to the rope. | |
13 | * | |
14 | * post-condition: Winch motor set to a specified speed. | |
15 | * | |
16 | * @param motorVal | |
17 | * value range is from -1 to 1 | |
9738295a SG |
18 | * |
19 | * @author shivanighanta | |
20 | * | |
21 | */ | |
22 | public class RunWinchContinuous extends Command { | |
23 | private double motorVal; | |
24 | ||
ad877a7e SG |
25 | /** |
26 | * | |
27 | * @param motorVal | |
28 | */ | |
9738295a | 29 | public RunWinchContinuous(double motorVal) { |
43980ce1 | 30 | requires(Robot.getClimber()); |
9738295a SG |
31 | this.motorVal = motorVal; |
32 | } | |
33 | ||
34 | @Override | |
35 | protected void initialize() { | |
5be898b7 | 36 | Robot.getClimber().setMotorValue(motorVal); |
cf086549 | 37 | |
9738295a SG |
38 | } |
39 | ||
40 | @Override | |
41 | protected void execute() { | |
42 | ||
43 | } | |
44 | ||
45 | @Override | |
46 | protected boolean isFinished() { | |
de8c65d3 | 47 | return !Robot.getOI().toggleWinch.get(); |
9738295a SG |
48 | } |
49 | ||
50 | @Override | |
51 | protected void end() { | |
a04ce2ff | 52 | Robot.getClimber().stop(); |
9738295a SG |
53 | } |
54 | ||
55 | @Override | |
56 | protected void interrupted() { | |
a04ce2ff | 57 | end(); |
9738295a SG |
58 | } |
59 | } |