Add constructer comments
[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
5 import edu.wpi.first.wpilibj.Timer;
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.
11 *
12 * pre-condition: This command is run by a button in OI. The robot must be
13 * attached to the rope.
14 *
15 * post-condition: Winch motor set to a specified speed for a specified time.
16 *
17 * @param motorVal
18 * value range is from -1 to 1
19 * @param time
20 * in seconds
21 * @author shivanighanta
22 *
23 */
24
25 public class RunWinch extends Command {
26 Timer timer;
27 private double time;
28 private double motorVal;
29
30 /**
31 *
32 * @author shivanighanta
33 *
34 */
35 public RunWinch(double time, double motorVal) {
36 requires(Robot.getClimber());
37 this.time = time;
38 this.motorVal = motorVal;
39 }
40
41 @Override
42 protected void initialize() {
43 timer.start();
44 Robot.getClimber().setMotorValue(motorVal);
45 }
46
47 @Override
48 protected void execute() {
49
50 }
51
52 @Override
53 protected boolean isFinished() {
54 return timer.get() >= time;
55 }
56
57 @Override
58 protected void end() {
59 Robot.getClimber().stop();
60 }
61
62 @Override
63 protected void interrupted() {
64 end();
65 }
66 }