1 package org
.usfirst
.frc
.team3501
.robot
;
3 import org
.usfirst
.frc
.team3501
.robot
.Constants
.Defense
;
4 import org
.usfirst
.frc
.team3501
.robot
.subsystems
.DefenseArm
;
5 import org
.usfirst
.frc
.team3501
.robot
.subsystems
.DriveTrain
;
6 import org
.usfirst
.frc
.team3501
.robot
.subsystems
.IntakeArm
;
7 import org
.usfirst
.frc
.team3501
.robot
.subsystems
.Scaler
;
8 import org
.usfirst
.frc
.team3501
.robot
.subsystems
.Shooter
;
10 import edu
.wpi
.first
.wpilibj
.IterativeRobot
;
11 import edu
.wpi
.first
.wpilibj
.command
.Scheduler
;
12 import edu
.wpi
.first
.wpilibj
.smartdashboard
.SendableChooser
;
13 import edu
.wpi
.first
.wpilibj
.smartdashboard
.SmartDashboard
;
15 public class Robot
extends IterativeRobot
{
17 public static DriveTrain driveTrain
;
18 public static Shooter shooter
;
19 public static Scaler scaler
;
20 public static DefenseArm defenseArm
;
21 public static IntakeArm intakeArm
;
22 public static DefenseArm defenseArm
;
24 // Sendable Choosers send a drop down menu to the Smart Dashboard.
25 SendableChooser positionChooser
;
26 SendableChooser positionOneDefense
, positionTwoDefense
, positionThreeDefense
,
27 positionFourDefense
, positionFiveDefense
;
30 public void robotInit() {
31 driveTrain
= new DriveTrain();
34 shooter
= new Shooter();
35 scaler
= new Scaler();
36 defenseArm
= new DefenseArm();
37 intakeArm
= new IntakeArm();
39 // Sendable Choosers allows the driver to select the position of the robot
40 // and the positions of the defenses from a drop-down menu on the Smart
42 // make the Sendable Choosers
43 initializeSendableChoosers();
44 addPositionChooserOptions();
45 addDefensesToAllDefenseSendableChooosers();
46 sendSendableChoosersToSmartDashboard();
50 private void initializeSendableChoosers() {
51 positionChooser
= new SendableChooser();
52 positionOneDefense
= new SendableChooser();
53 positionTwoDefense
= new SendableChooser();
54 positionThreeDefense
= new SendableChooser();
55 positionFourDefense
= new SendableChooser();
56 positionFiveDefense
= new SendableChooser();
59 private void addPositionChooserOptions() {
60 positionChooser
.addDefault("Position 1", 1);
61 positionChooser
.addObject("Position 2", 2);
62 positionChooser
.addObject("Position 3", 3);
63 positionChooser
.addObject("Position 4", 4);
64 positionChooser
.addObject("Position 5", 5);
67 private void addDefensesToAllDefenseSendableChooosers() {
68 addDefenseOptions(positionOneDefense
);
69 addDefenseOptions(positionTwoDefense
);
70 addDefenseOptions(positionThreeDefense
);
71 addDefenseOptions(positionFourDefense
);
72 addDefenseOptions(positionFiveDefense
);
75 private void addDefenseOptions(SendableChooser chooser
) {
76 chooser
.addDefault("Portcullis", Defense
.PORTCULLIS
);
77 chooser
.addObject("Sally Port", Defense
.SALLY_PORT
);
78 chooser
.addObject("Rough Terrain", Defense
.ROUGH_TERRAIN
);
79 chooser
.addObject("Low Bar", Defense
.LOW_BAR
);
80 chooser
.addObject("Cheval De Frise", Defense
.CHEVAL_DE_FRISE
);
81 chooser
.addObject("Drawbridge", Defense
.DRAWBRIDGE
);
82 chooser
.addObject("Moat", Defense
.MOAT
);
83 chooser
.addObject("Rock Wall", Defense
.ROCK_WALL
);
86 private void sendSendableChoosersToSmartDashboard() {
87 SmartDashboard
.putData("PositionChooser", positionChooser
);
88 SmartDashboard
.putData("Position One Defense Chooser", positionOneDefense
);
89 SmartDashboard
.putData("Position Two Defense Chooser", positionTwoDefense
);
90 SmartDashboard
.putData("Position Three Defense Chooser",
91 positionThreeDefense
);
92 SmartDashboard
.putData("Position Four Defense Chooser",
94 SmartDashboard
.putData("Position Five Defense Chooser",
98 SmartDashboard
.putData("Position Four Defense Chooser",
100 SmartDashboard
.putData("Position Five Defense Chooser",
101 positionFiveDefense
);
103 shooter
= new Shooter();
104 >>>>>>> Initialize AnalogGyro in Robot
class
107 private void addDefense(SendableChooser chooser
) {
108 chooser
.addDefault("Portcullis", Defense
.PORTCULLIS
);
109 chooser
.addObject("Sally Port", Defense
.SALLY_PORT
);
110 chooser
.addObject("Rough Terrain", Defense
.ROUGH_TERRAIN
);
111 chooser
.addObject("Low Bar", Defense
.LOW_BAR
);
112 chooser
.addObject("Cheval De Frise", Defense
.CHEVAL_DE_FRISE
);
113 chooser
.addObject("Drawbridge", Defense
.DRAWBRIDGE
);
114 chooser
.addObject("Moat", Defense
.MOAT
);
115 chooser
.addObject("Rock Wall", Defense
.ROCK_WALL
);
117 shooter
= new Shooter();
122 public void autonomousInit() {
123 Scheduler
.getInstance().run();
125 // get options chosen from drop down menu
126 Integer chosenPosition
= (Integer
) positionChooser
.getSelected();
127 Integer chosenDefense
= 0;
129 switch (chosenPosition
) {
131 chosenDefense
= (Integer
) positionOneDefense
.getSelected();
133 chosenDefense
= (Integer
) positionTwoDefense
.getSelected();
135 chosenDefense
= (Integer
) positionThreeDefense
.getSelected();
137 chosenDefense
= (Integer
) positionFourDefense
.getSelected();
139 chosenDefense
= (Integer
) positionFiveDefense
.getSelected();
142 System
.out
.println("Chosen Position: " + chosenPosition
);
143 System
.out
.println("Chosen Defense: " + chosenDefense
);
147 public void autonomousPeriodic() {
148 Scheduler
.getInstance().run();
152 public void teleopInit() {
156 public void teleopPeriodic() {
157 Scheduler
.getInstance().run();