make a method for initializing all the Sendable Choosers
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / Robot.java
index 63b18399873f930b0df50693438707e1fd325007..37b3c24671f8b6c96d8e879c1d53d756729c8dba 100644 (file)
@@ -15,12 +15,9 @@ public class Robot extends IterativeRobot {
   public static Shooter shooter;
 
   // Sendable Choosers send a drop down menu to the Smart Dashboard.
-  SendableChooser positionOneDefense;
-  SendableChooser positionTwoDefense;
-  SendableChooser positionThreeDefense;
-  SendableChooser positionFourDefense;
-  SendableChooser positionFiveDefense;
   SendableChooser positionChooser;
+  SendableChooser positionOneDefense, positionTwoDefense, positionThreeDefense,
+      positionFourDefense, positionFiveDefense;
 
   @Override
   public void robotInit() {
@@ -28,13 +25,7 @@ public class Robot extends IterativeRobot {
     oi = new OI();
     shooter = new Shooter();
 
-    // initialize all the Sendable Choosers
-    positionChooser = new SendableChooser();
-    positionOneDefense = new SendableChooser();
-    positionTwoDefense = new SendableChooser();
-    positionThreeDefense = new SendableChooser();
-    positionFourDefense = new SendableChooser();
-    positionFiveDefense = new SendableChooser();
+    initializeSendableChoosers();
 
     // add options for positions to the positionChooser
     positionChooser.addDefault("Position 1", 1);
@@ -65,6 +56,16 @@ public class Robot extends IterativeRobot {
         positionFiveDefense);
   }
 
+  // initialize all the Sendable Choosers
+  private void initializeSendableChoosers() {
+    positionChooser = new SendableChooser();
+    positionOneDefense = new SendableChooser();
+    positionTwoDefense = new SendableChooser();
+    positionThreeDefense = new SendableChooser();
+    positionFourDefense = new SendableChooser();
+    positionFiveDefense = new SendableChooser();
+  }
+
   private void addDefense(SendableChooser chooser) {
     chooser.addDefault("Portcullis", Defense.PORTCULLIS);
     chooser.addObject("Sally Port", Defense.SALLY_PORT);