implement ToggleWinch command
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / commands / climber / RunWinchContinuous.java
CommitLineData
9738295a
SG
1package org.usfirst.frc.team3501.robot.commands.climber;
2
a04ce2ff 3import org.usfirst.frc.team3501.robot.Robot;
9dc69158 4import org.usfirst.frc.team3501.robot.subsystems.DriveTrain;
a04ce2ff 5
9738295a
SG
6import edu.wpi.first.wpilibj.command.Command;
7
8/**
d8ebba03
CZ
9 * This command runs the drive train motors (which runs the winch) continuously
10 * at a specified speed until the button triggering it is released
e2e9a7a7 11 *
2a9dabb1
CZ
12 * pre-condition: This command must be run by a button in OI with
13 * button.whileHeld(...). The robot must be attached to the rope.
e2e9a7a7 14 *
d8ebba03 15 * post-condition: Drive train motors set to a specified speed.
e2e9a7a7 16 *
9738295a
SG
17 * @author shivanighanta
18 *
19 */
20public class RunWinchContinuous extends Command {
cb949663 21
9dc69158
CZ
22 DriveTrain driveTrain = Robot.getDriveTrain();
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() {
9dc69158
CZ
32 requires(driveTrain);
33 climbingSpeed = driveTrain.CLIMBER_SPEED;
ffb43c5c 34 requires(Robot.getDriveTrain());
cb949663 35 requires(driveTrain);
9738295a
SG
36 }
37
38 @Override
39 protected void initialize() {
40 }
41
42 @Override
43 protected void execute() {
9dc69158 44 Robot.getDriveTrain().setMotorValues(climbingSpeed, climbingSpeed);
9738295a
SG
45 }
46
47 @Override
48 protected boolean isFinished() {
3e515b75 49 return false;
9738295a
SG
50 }
51
52 @Override
53 protected void end() {
411129cd 54
9738295a
SG
55 }
56
57 @Override
58 protected void interrupted() {
a04ce2ff 59 end();
9738295a
SG
60 }
61}