add a testCommandGroup abstract class
authorEric Sandoval <harpnart@gmail.com>
Fri, 3 Feb 2017 04:30:06 +0000 (20:30 -0800)
committerEric Sandoval <harpnart@gmail.com>
Fri, 3 Feb 2017 04:30:06 +0000 (20:30 -0800)
src/org/usfirst/frc/team3501/robot/Robot.java
src/org/usfirst/frc/team3501/robot/commandgroups/TestCommandGroup.java [new file with mode: 0644]

index 9d87c50183ab81e60006afcd78de2d620e167182..94fc6c0b56602d39ebc1ee39d2586ddaa98e4fdf 100644 (file)
@@ -1,5 +1,7 @@
 package org.usfirst.frc.team3501.robot;
 
+import org.usfirst.frc.team3501.robot.commandgroups.PrepareToShoot;
+import org.usfirst.frc.team3501.robot.commandgroups.Shoot;
 import org.usfirst.frc.team3501.robot.subsystems.DriveTrain;
 import org.usfirst.frc.team3501.robot.subsystems.Intake;
 import org.usfirst.frc.team3501.robot.subsystems.Shooter;
@@ -8,6 +10,7 @@ import edu.wpi.first.wpilibj.IterativeRobot;
 import edu.wpi.first.wpilibj.command.CommandGroup;
 import edu.wpi.first.wpilibj.command.Scheduler;
 import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
+import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
 
 public class Robot extends IterativeRobot {
 
@@ -26,6 +29,11 @@ public class Robot extends IterativeRobot {
     intake = Intake.getIntake();
     chooser = new SendableChooser();
 
+    SendableChooser autoChooser = new SendableChooser();
+    autoChooser.addDefault("Prepare to Shoot", new PrepareToShoot());
+    autoChooser.addObject("Shoot", new Shoot());
+    SmartDashboard.putData("Autonomous mode chooser", autoChooser);
+
   }
 
   public static DriveTrain getDriveTrain() {
diff --git a/src/org/usfirst/frc/team3501/robot/commandgroups/TestCommandGroup.java b/src/org/usfirst/frc/team3501/robot/commandgroups/TestCommandGroup.java
new file mode 100644 (file)
index 0000000..dcf8cc1
--- /dev/null
@@ -0,0 +1,20 @@
+package org.usfirst.frc.team3501.robot.commandgroups;
+
+import edu.wpi.first.wpilibj.command.CommandGroup;
+
+public abstract class TestCommandGroup extends CommandGroup {
+
+  private TestCommandGroup() {
+    setup();
+    runCommandGroup();
+    teardown();
+
+  }
+
+  abstract void runCommandGroup();
+
+  abstract void setup();
+
+  abstract void teardown();
+
+}