competition fixes
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / commands / climber / RunWinch.java
1 package org.usfirst.frc.team3501.robot.commands.climber;
2
3 import org.usfirst.frc.team3501.robot.Robot;
4 import org.usfirst.frc.team3501.robot.subsystems.Climber;
5
6 import edu.wpi.first.wpilibj.command.Command;
7
8 /**
9 * This command runs the winch at a specified speed and time in seconds when the
10 * button triggering it is pressed. This command also makes the drive train
11 * motors run because the winch is controlled by the drive train.
12 *
13 * pre-condition: This command is run by a button in OI. The robot must be
14 * attached to the rope.
15 *
16 * post-condition: Winch motor set to a specified speed for a specified time.
17 *
18 * @param motorVal
19 * value range is from -1 to 1
20 * @param time
21 * in seconds
22 * @author shivanighanta
23 *
24 */
25
26 public class RunWinch extends Command {
27 Climber climber = Robot.getClimber();
28
29 private double time;
30 private double motorVal;
31
32 /**
33 * See JavaDoc comment in class for details
34 *
35 * @param time
36 * time in seconds to run the winch
37 * @param motorVal
38 * value range is from -1 to 1
39 */
40 public RunWinch() {
41 requires(climber);
42 this.time = time;
43 this.motorVal = motorVal;
44 }
45
46 @Override
47 protected void initialize() {
48 climber.setCANTalonsBrakeMode(climber.COAST_MODE);
49 }
50
51 @Override
52 protected void execute() {
53 climber.setMotorValues(climber.CLIMBER_SPEED);
54 }
55
56 @Override
57 protected boolean isFinished() {
58 // return timeSinceInitialized() >= time;
59 return false;
60 }
61
62 @Override
63 protected void end() {
64 climber.stop();
65 }
66
67 @Override
68 protected void interrupted() {
69 end();
70 }
71 }