implement MoveIntakeArmToLevel command group
authorMeryem Esa <meresa14@gmail.com>
Thu, 18 Feb 2016 23:00:14 +0000 (15:00 -0800)
committerKevin Zhang <icestormf1@gmail.com>
Thu, 18 Feb 2016 23:08:03 +0000 (15:08 -0800)
src/org/usfirst/frc/team3501/robot/commands/intakearm/MoveIntakeArmToLevel.java [new file with mode: 0755]

diff --git a/src/org/usfirst/frc/team3501/robot/commands/intakearm/MoveIntakeArmToLevel.java b/src/org/usfirst/frc/team3501/robot/commands/intakearm/MoveIntakeArmToLevel.java
new file mode 100755 (executable)
index 0000000..9943bcd
--- /dev/null
@@ -0,0 +1,30 @@
+package org.usfirst.frc.team3501.robot.commands.intakearm;
+
+import org.usfirst.frc.team3501.robot.Robot;
+
+import edu.wpi.first.wpilibj.command.CommandGroup;
+
+/**
+ * This command group will move the arm to the specified level. Levels
+ * correspond to the angles stored in the potAngles array list saved in the
+ * IntakeArm subsystem. (starting from level 0)
+ *
+ * pre-condition: level >= 0 && level < potAngles.length
+ *
+ * post-condition: arm has moved to specified level
+ *
+ * @author Meryem
+ */
+public class MoveIntakeArmToLevel extends CommandGroup {
+
+  public MoveIntakeArmToLevel(int level) {
+    requires(Robot.intakeArm);
+
+    if (level < 0 || level >= Robot.intakeArm.potAngles.length)
+      this.end();
+
+    addSequential(
+        new MoveIntakeArmToAngle(Robot.intakeArm.potAngles[level], 0));
+
+  }
+}