X-Git-Url: http://challenge-bot.com/repos/?a=blobdiff_plain;f=src%2Forg%2Fusfirst%2Ffrc%2Fteam3501%2Frobot%2FRobot.java;h=d2298119c7988ab2a885b8eadfa107c22eda0c36;hb=a0ff09b3c93c916ce06ad22e1326867e1c9ca14a;hp=f42d6a4138fba1fed5514577f6f28101c8d677c7;hpb=3366a59a6d8f355ac8bba05c7011f8458e0c96c0;p=3501%2Fstronghold-2016 diff --git a/src/org/usfirst/frc/team3501/robot/Robot.java b/src/org/usfirst/frc/team3501/robot/Robot.java index f42d6a41..d2298119 100644 --- a/src/org/usfirst/frc/team3501/robot/Robot.java +++ b/src/org/usfirst/frc/team3501/robot/Robot.java @@ -17,6 +17,7 @@ public class Robot extends IterativeRobot { PORTCULLIS, SALLY_PORT, ROUGH_TERRAIN, LOW_BAR, CHEVAL_DE_FRISE, DRAWBRIDGE, MOAT, ROCK_WALL }; + // Sendable Choosers send a drop down menu to the Smart Dashboard. SendableChooser positionOneDefense; SendableChooser positionTwoDefense; SendableChooser positionThreeDefense; @@ -30,7 +31,7 @@ public class Robot extends IterativeRobot { oi = new OI(); shooter = new Shooter(); - // intialize all the Sendable Choosers + // initialize all the Sendable Choosers positionChooser = new SendableChooser(); positionOneDefense = new SendableChooser(); positionTwoDefense = new SendableChooser(); @@ -52,13 +53,19 @@ public class Robot extends IterativeRobot { addDefense(positionFourDefense); addDefense(positionFiveDefense); - SmartDashboard.putData("Position", positionChooser); - SmartDashboard.putData("Position One Defense", positionOneDefense); - SmartDashboard.putData("Position Two Defense", positionTwoDefense); - SmartDashboard.putData("Position Three Defense", positionThreeDefense); - SmartDashboard.putData("Position Four Defense", positionFourDefense); - SmartDashboard.putData("Position Five Defense", positionFiveDefense); - + // send the Sendable Choosers to the Smart Dashboard + // Sendable Choosers allows the driver to select the position of the robot + // and the positions of the defenses from a drop-down menu on the Smart + // Dashboard + SmartDashboard.putData("PositionChooser", positionChooser); + SmartDashboard.putData("Position One Defense Chooser", positionOneDefense); + SmartDashboard.putData("Position Two Defense Chooser", positionTwoDefense); + SmartDashboard.putData("Position Three Defense Chooser", + positionThreeDefense); + SmartDashboard.putData("Position Four Defense Chooser", + positionFourDefense); + SmartDashboard.putData("Position Five Defense Chooser", + positionFiveDefense); } private void addDefense(SendableChooser chooser) { @@ -78,18 +85,20 @@ public class Robot extends IterativeRobot { // get options chosen from drop down menu Integer chosenPosition = (Integer) positionChooser.getSelected(); - Integer chosenDefense = -1; + Integer chosenDefense = 0; - if (chosenPosition == 1) + switch (chosenPosition) { + case 1: chosenDefense = (Integer) positionOneDefense.getSelected(); - if (chosenPosition == 2) + case 2: chosenDefense = (Integer) positionTwoDefense.getSelected(); - if (chosenPosition == 3) + case 3: chosenDefense = (Integer) positionThreeDefense.getSelected(); - if (chosenPosition == 4) + case 4: chosenDefense = (Integer) positionFourDefense.getSelected(); - if (chosenPosition == 5) + case 5: chosenDefense = (Integer) positionFiveDefense.getSelected(); + } System.out.println("Chosen Position: " + chosenPosition); System.out.println("Chosen Defense: " + chosenDefense); @@ -102,7 +111,6 @@ public class Robot extends IterativeRobot { @Override public void teleopInit() { - System.out.println("running teleopInit"); } @Override @@ -110,9 +118,4 @@ public class Robot extends IterativeRobot { Scheduler.getInstance().run(); } - - public void operate() { - - } - }