Saved
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / commands / climber / RunWinchContinuous.java
CommitLineData
9738295a
SG
1package org.usfirst.frc.team3501.robot.commands.climber;
2
150f450f 3import org.usfirst.frc.team3501.robot.OI;
a04ce2ff 4import org.usfirst.frc.team3501.robot.Robot;
150f450f 5import org.usfirst.frc.team3501.robot.subsystems.Climber;
a04ce2ff 6
9738295a
SG
7import 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 */
21public 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() {
38 }
39
40 @Override
41 protected void execute() {
8275a069 42 double thrust = OI.xboxController.getY();
150f450f 43 climber.setMotorValues(-thrust);
9738295a
SG
44 }
45
46 @Override
47 protected boolean isFinished() {
3e515b75 48 return false;
9738295a
SG
49 }
50
51 @Override
52 protected void end() {
150f450f 53 climber.stop();
9738295a
SG
54 }
55
56 @Override
57 protected void interrupted() {
a04ce2ff 58 end();
9738295a
SG
59 }
60}