Fix a spelling error :(
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / Robot.java
CommitLineData
38a404b3
KZ
1package org.usfirst.frc.team3501.robot;
2
3import org.usfirst.frc.team3501.robot.Constants.DriveTrain;
40348cab
E
4import org.usfirst.frc.team3501.robot.subsystems.Shooter;
5
38a404b3
KZ
6import edu.wpi.first.wpilibj.IterativeRobot;
7import edu.wpi.first.wpilibj.command.Scheduler;
3366a59a
ME
8import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
9import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
38a404b3
KZ
10
11public class Robot extends IterativeRobot {
12 public static OI oi;
13 public static DriveTrain driveTrain;
40348cab 14 public static Shooter shooter;
38a404b3 15
3366a59a
ME
16 enum Defense {
17 PORTCULLIS, SALLY_PORT, ROUGH_TERRAIN, LOW_BAR, CHEVAL_DE_FRISE, DRAWBRIDGE, MOAT, ROCK_WALL
18 };
19
88e66b4e 20 // Sendable Choosers send a drop down menu to the Smart Dashboard.
3366a59a
ME
21 SendableChooser positionOneDefense;
22 SendableChooser positionTwoDefense;
23 SendableChooser positionThreeDefense;
24 SendableChooser positionFourDefense;
25 SendableChooser positionFiveDefense;
26 SendableChooser positionChooser;
27
38a404b3
KZ
28 @Override
29 public void robotInit() {
30 driveTrain = new DriveTrain();
31 oi = new OI();
40348cab 32 shooter = new Shooter();
3366a59a 33
a0ff09b3 34 // initialize all the Sendable Choosers
3366a59a
ME
35 positionChooser = new SendableChooser();
36 positionOneDefense = new SendableChooser();
37 positionTwoDefense = new SendableChooser();
38 positionThreeDefense = new SendableChooser();
39 positionFourDefense = new SendableChooser();
40 positionFiveDefense = new SendableChooser();
41
42 // add options for positions to the positionChooser
43 positionChooser.addDefault("Position 1", 1);
44 positionChooser.addObject("Position 2", 2);
45 positionChooser.addObject("Position 3", 3);
46 positionChooser.addObject("Position 4", 4);
47 positionChooser.addObject("Position 5", 5);
48
49 // add options for defenses into each defense chooser (5)
50 addDefense(positionOneDefense);
51 addDefense(positionTwoDefense);
52 addDefense(positionThreeDefense);
53 addDefense(positionFourDefense);
54 addDefense(positionFiveDefense);
55
e13d2293 56 // send the Sendable Choosers to the Smart Dashboard
88e66b4e
ME
57 // Sendable Choosers allows the driver to select the position of the robot
58 // and the positions of the defenses from a drop-down menu on the Smart
59 // Dashboard
e13d2293
A
60 SmartDashboard.putData("PositionChooser", positionChooser);
61 SmartDashboard.putData("Position One Defense Chooser", positionOneDefense);
62 SmartDashboard.putData("Position Two Defense Chooser", positionTwoDefense);
63 SmartDashboard.putData("Position Three Defense Chooser",
64 positionThreeDefense);
65 SmartDashboard.putData("Position Four Defense Chooser",
66 positionFourDefense);
67 SmartDashboard.putData("Position Five Defense Chooser",
68 positionFiveDefense);
3366a59a
ME
69 }
70
71 private void addDefense(SendableChooser chooser) {
72 chooser.addDefault("Portcullis", Defense.PORTCULLIS);
73 chooser.addObject("Sally Port", Defense.SALLY_PORT);
74 chooser.addObject("Rough Terrain", Defense.ROUGH_TERRAIN);
75 chooser.addObject("Low Bar", Defense.LOW_BAR);
76 chooser.addObject("Cheval De Frise", Defense.CHEVAL_DE_FRISE);
77 chooser.addObject("Drawbridge", Defense.DRAWBRIDGE);
78 chooser.addObject("Moat", Defense.MOAT);
79 chooser.addObject("Rock Wall", Defense.ROCK_WALL);
38a404b3
KZ
80 }
81
82 @Override
83 public void autonomousInit() {
3366a59a
ME
84 Scheduler.getInstance().run();
85
86 // get options chosen from drop down menu
87 Integer chosenPosition = (Integer) positionChooser.getSelected();
e13d2293 88 Integer chosenDefense = 0;
3366a59a 89
33981335
ME
90 switch (chosenPosition) {
91 case 1:
3366a59a 92 chosenDefense = (Integer) positionOneDefense.getSelected();
33981335 93 case 2:
3366a59a 94 chosenDefense = (Integer) positionTwoDefense.getSelected();
33981335 95 case 3:
3366a59a 96 chosenDefense = (Integer) positionThreeDefense.getSelected();
33981335 97 case 4:
3366a59a 98 chosenDefense = (Integer) positionFourDefense.getSelected();
33981335 99 case 5:
3366a59a 100 chosenDefense = (Integer) positionFiveDefense.getSelected();
33981335 101 }
3366a59a
ME
102
103 System.out.println("Chosen Position: " + chosenPosition);
104 System.out.println("Chosen Defense: " + chosenDefense);
38a404b3
KZ
105 }
106
107 @Override
108 public void autonomousPeriodic() {
109 Scheduler.getInstance().run();
38a404b3
KZ
110 }
111
112 @Override
113 public void teleopInit() {
114 }
115
116 @Override
117 public void teleopPeriodic() {
118 Scheduler.getInstance().run();
119
120 }
121}