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 | /** | |
45d8eb0f SG |
8 | * This command runs the winch motor continuously at a specified speed until the |
9 | * button triggering it is released. This command also makes the drive train | |
10 | * motors run because the winch is controlled by the drive train. | |
e2e9a7a7 SG |
11 | * |
12 | * pre-condition: This command must be run by a button in OI. The robot must be | |
13 | * attached to the rope. | |
14 | * | |
15 | * post-condition: Winch motor set to a specified speed. | |
16 | * | |
9738295a SG |
17 | * @author shivanighanta |
18 | * | |
19 | */ | |
20 | public class RunWinchContinuous extends Command { | |
21 | private double motorVal; | |
22 | ||
ad877a7e | 23 | /** |
411129cd SG |
24 | * See JavaDoc comment in class for details |
25 | * | |
ad877a7e | 26 | * @param motorVal |
411129cd | 27 | * value range is from -1 to 1 |
ad877a7e | 28 | */ |
9738295a | 29 | public RunWinchContinuous(double motorVal) { |
411129cd | 30 | requires(Robot.getDriveTrain()); |
9738295a SG |
31 | this.motorVal = motorVal; |
32 | } | |
33 | ||
34 | @Override | |
35 | protected void initialize() { | |
411129cd | 36 | Robot.getDriveTrain().setMotorValues(motorVal, motorVal); |
9738295a SG |
37 | } |
38 | ||
39 | @Override | |
40 | protected void execute() { | |
41 | ||
42 | } | |
43 | ||
44 | @Override | |
45 | protected boolean isFinished() { | |
b71b71bc | 46 | return !Robot.getOI().toggleWinch.get(); |
9738295a SG |
47 | } |
48 | ||
49 | @Override | |
50 | protected void end() { | |
411129cd | 51 | |
9738295a SG |
52 | } |
53 | ||
54 | @Override | |
55 | protected void interrupted() { | |
a04ce2ff | 56 | end(); |
9738295a SG |
57 | } |
58 | } |