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