Fix import issue to import the right drivetrain
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / Robot.java
CommitLineData
38a404b3
KZ
1package org.usfirst.frc.team3501.robot;
2
53d61b3e 3import org.usfirst.frc.team3501.robot.Constants.Defense;
91aac7a6 4import org.usfirst.frc.team3501.robot.subsystems.DriveTrain;
40348cab
E
5import org.usfirst.frc.team3501.robot.subsystems.Shooter;
6
38a404b3
KZ
7import edu.wpi.first.wpilibj.IterativeRobot;
8import edu.wpi.first.wpilibj.command.Scheduler;
3366a59a
ME
9import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
10import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
38a404b3
KZ
11
12public class Robot extends IterativeRobot {
13 public static OI oi;
14 public static DriveTrain driveTrain;
40348cab 15 public static Shooter shooter;
38a404b3 16
88e66b4e 17 // Sendable Choosers send a drop down menu to the Smart Dashboard.
3366a59a
ME
18 SendableChooser positionOneDefense;
19 SendableChooser positionTwoDefense;
20 SendableChooser positionThreeDefense;
21 SendableChooser positionFourDefense;
22 SendableChooser positionFiveDefense;
23 SendableChooser positionChooser;
24
38a404b3
KZ
25 @Override
26 public void robotInit() {
27 driveTrain = new DriveTrain();
28 oi = new OI();
40348cab 29 shooter = new Shooter();
3366a59a 30
a0ff09b3 31 // initialize all the Sendable Choosers
3366a59a
ME
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
e13d2293 53 // send the Sendable Choosers to the Smart Dashboard
88e66b4e
ME
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
e13d2293
A
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);
3366a59a
ME
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);
38a404b3
KZ
77 }
78
79 @Override
80 public void autonomousInit() {
3366a59a
ME
81 Scheduler.getInstance().run();
82
83 // get options chosen from drop down menu
84 Integer chosenPosition = (Integer) positionChooser.getSelected();
e13d2293 85 Integer chosenDefense = 0;
3366a59a 86
33981335
ME
87 switch (chosenPosition) {
88 case 1:
3366a59a 89 chosenDefense = (Integer) positionOneDefense.getSelected();
33981335 90 case 2:
3366a59a 91 chosenDefense = (Integer) positionTwoDefense.getSelected();
33981335 92 case 3:
3366a59a 93 chosenDefense = (Integer) positionThreeDefense.getSelected();
33981335 94 case 4:
3366a59a 95 chosenDefense = (Integer) positionFourDefense.getSelected();
33981335 96 case 5:
3366a59a 97 chosenDefense = (Integer) positionFiveDefense.getSelected();
33981335 98 }
3366a59a
ME
99
100 System.out.println("Chosen Position: " + chosenPosition);
101 System.out.println("Chosen Defense: " + chosenDefense);
38a404b3
KZ
102 }
103
104 @Override
105 public void autonomousPeriodic() {
106 Scheduler.getInstance().run();
38a404b3
KZ
107 }
108
109 @Override
110 public void teleopInit() {
111 }
112
113 @Override
114 public void teleopPeriodic() {
115 Scheduler.getInstance().run();
116
117 }
118}