Commit | Line | Data |
---|---|---|
9738295a SG |
1 | package org.usfirst.frc.team3501.robot.commands.climber; |
2 | ||
150f450f | 3 | import org.usfirst.frc.team3501.robot.OI; |
a04ce2ff | 4 | import org.usfirst.frc.team3501.robot.Robot; |
150f450f | 5 | import org.usfirst.frc.team3501.robot.subsystems.Climber; |
a04ce2ff | 6 | |
9738295a SG |
7 | import edu.wpi.first.wpilibj.command.Command; |
8 | ||
9 | /** | |
d8ebba03 CZ |
10 | * This command runs the drive train motors (which runs the winch) continuously |
11 | * at a specified speed until the button triggering it is released | |
e2e9a7a7 | 12 | * |
2a9dabb1 CZ |
13 | * pre-condition: This command must be run by a button in OI with |
14 | * button.whileHeld(...). The robot must be attached to the rope. | |
e2e9a7a7 | 15 | * |
d8ebba03 | 16 | * post-condition: Drive train motors set to a specified speed. |
e2e9a7a7 | 17 | * |
9738295a SG |
18 | * @author shivanighanta |
19 | * | |
20 | */ | |
21 | public class RunWinchContinuous extends Command { | |
150f450f | 22 | Climber climber = Robot.getClimber(); |
9dc69158 | 23 | private double climbingSpeed; |
9738295a | 24 | |
ad877a7e | 25 | /** |
411129cd SG |
26 | * See JavaDoc comment in class for details |
27 | * | |
ad877a7e | 28 | * @param motorVal |
411129cd | 29 | * value range is from -1 to 1 |
ad877a7e | 30 | */ |
cef1f36d | 31 | public RunWinchContinuous() { |
150f450f CZ |
32 | requires(climber); |
33 | climbingSpeed = climber.CLIMBER_SPEED; | |
9738295a SG |
34 | } |
35 | ||
36 | @Override | |
37 | protected void initialize() { | |
f74d236d | 38 | climber.setCANTalonsBrakeMode(climber.COAST_MODE); |
9738295a SG |
39 | } |
40 | ||
41 | @Override | |
42 | protected void execute() { | |
8275a069 | 43 | double thrust = OI.xboxController.getY(); |
150f450f | 44 | climber.setMotorValues(-thrust); |
9738295a SG |
45 | } |
46 | ||
47 | @Override | |
48 | protected boolean isFinished() { | |
3e515b75 | 49 | return false; |
9738295a SG |
50 | } |
51 | ||
52 | @Override | |
53 | protected void end() { | |
150f450f | 54 | climber.stop(); |
9738295a SG |
55 | } |
56 | ||
57 | @Override | |
58 | protected void interrupted() { | |
a04ce2ff | 59 | end(); |
9738295a SG |
60 | } |
61 | } |