make MoveToLevel
[3501/2015-FRC-Spark] / src / org / usfirst / frc3501 / RiceCatRobot / commands / MoveToLevel.java
1 package org.usfirst.frc3501.RiceCatRobot.commands;
2
3 import org.usfirst.frc3501.RiceCatRobot.Robot;
4 import org.usfirst.frc3501.RiceCatRobot.RobotMap;
5
6 import edu.wpi.first.wpilibj.command.Command;
7
8 public class MoveToLevel extends Command{
9
10 int targetLevel, currentLevel;
11
12 public MoveToLevel(int targetLevel) {
13 this.targetLevel = targetLevel;
14 }
15
16 @Override
17 protected void initialize() {
18
19 }
20
21 @Override
22 protected void execute() {
23 Robot.arm.setArmSpeeds(RobotMap.ARM_LOW_SPEED);
24 }
25
26 @Override
27 protected boolean isFinished() {
28 if(currentLevel == targetLevel) return true;
29 return false;
30 }
31
32 @Override
33 protected void end() {
34 Robot.arm.setArmSpeeds(0);
35 }
36
37 @Override
38 protected void interrupted() {
39 end();
40 }
41
42 }