Implement RunWinch
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / commands / climber / RunWinch.java
CommitLineData
9738295a
SG
1package org.usfirst.frc.team3501.robot.commands.climber;
2
6a363924
SG
3import org.usfirst.frc.team3501.robot.Robot;
4
5import com.sun.glass.ui.Timer;
6
9738295a
SG
7import edu.wpi.first.wpilibj.command.Command;
8
9/**
dbf2ff8f 10 * Runs the winch for a given time and motor value
9738295a
SG
11 *
12 * @author shivanighanta
13 *
14 */
15public class RunWinch extends Command {
6a363924 16 Timer timer;
9738295a
SG
17 private double time;
18 private double motorVal;
19
20 public RunWinch(double time, double motorVal) {
6a363924 21 requires(Robot.getClimber());
9738295a
SG
22 this.time = time;
23 this.motorVal = motorVal;
24 }
25
26 @Override
27 protected void initialize() {
6a363924
SG
28 timer.start();
29 Robot.getClimber().setMotorValues(motorVal, motorVal);
9738295a
SG
30 }
31
32 @Override
33 protected void execute() {
34
35 }
36
37 @Override
38 protected boolean isFinished() {
6a363924 39 return timer.get() >= time;
9738295a
SG
40 }
41
42 @Override
43 protected void end() {
6a363924 44 Robot.getClimber().stop();
9738295a
SG
45 }
46
47 @Override
48 protected void interrupted() {
6a363924 49 end();
9738295a
SG
50 }
51}