competition fixes
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / commands / climber / RunWinchContinuous.java
1 package org.usfirst.frc.team3501.robot.commands.climber;
2
3 import org.usfirst.frc.team3501.robot.OI;
4 import org.usfirst.frc.team3501.robot.Robot;
5 import org.usfirst.frc.team3501.robot.subsystems.Climber;
6
7 import edu.wpi.first.wpilibj.command.Command;
8
9 /**
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
12 *
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.
15 *
16 * post-condition: Drive train motors set to a specified speed.
17 *
18 * @author shivanighanta
19 *
20 */
21 public class RunWinchContinuous extends Command {
22 Climber climber = Robot.getClimber();
23 private double climbingSpeed;
24
25 /**
26 * See JavaDoc comment in class for details
27 *
28 * @param motorVal
29 * value range is from -1 to 1
30 */
31 public RunWinchContinuous() {
32 requires(climber);
33 climbingSpeed = climber.CLIMBER_SPEED;
34 }
35
36 @Override
37 protected void initialize() {
38 climber.setCANTalonsBrakeMode(climber.COAST_MODE);
39 }
40
41 @Override
42 protected void execute() {
43 double thrust = OI.xboxController.getY();
44 climber.setMotorValues(-thrust);
45 }
46
47 @Override
48 protected boolean isFinished() {
49 return false;
50 }
51
52 @Override
53 protected void end() {
54 climber.stop();
55 }
56
57 @Override
58 protected void interrupted() {
59 end();
60 }
61 }