Implement RunWinch
[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 com.sun.glass.ui.Timer;
6
7 import edu.wpi.first.wpilibj.command.Command;
8
9 /**
10 * Runs the winch for a given time and motor value
11 *
12 * @author shivanighanta
13 *
14 */
15 public class RunWinch extends Command {
16 Timer timer;
17 private double time;
18 private double motorVal;
19
20 public RunWinch(double time, double motorVal) {
21 requires(Robot.getClimber());
22 this.time = time;
23 this.motorVal = motorVal;
24 }
25
26 @Override
27 protected void initialize() {
28 timer.start();
29 Robot.getClimber().setMotorValues(motorVal, motorVal);
30 }
31
32 @Override
33 protected void execute() {
34
35 }
36
37 @Override
38 protected boolean isFinished() {
39 return timer.get() >= time;
40 }
41
42 @Override
43 protected void end() {
44 Robot.getClimber().stop();
45 }
46
47 @Override
48 protected void interrupted() {
49 end();
50 }
51 }