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
;
20 public static Scaler scaler
;
21 public static DefenseArm defenseArm
;
22 public static IntakeArm intakeArm
;
23 public static DefenseArm defenseArm
;
25 // Sendable Choosers send a drop down menu to the Smart Dashboard.
26 SendableChooser positionChooser
;
27 SendableChooser positionOneDefense
, positionTwoDefense
, positionThreeDefense
,
28 positionFourDefense
, positionFiveDefense
;
31 public void robotInit() {
32 driveTrain
= new DriveTrain();
35 shooter
= new Shooter();
36 scaler
= new Scaler();
37 defenseArm
= new DefenseArm();
38 intakeArm
= new IntakeArm();
40 // Sendable Choosers allows the driver to select the position of the robot
41 // and the positions of the defenses from a drop-down menu on the Smart
43 // make the Sendable Choosers
44 initializeSendableChoosers();
45 addPositionChooserOptions();
46 addDefensesToAllDefenseSendableChooosers();
47 sendSendableChoosersToSmartDashboard();
51 private void initializeSendableChoosers() {
52 positionChooser
= new SendableChooser();
53 positionOneDefense
= new SendableChooser();
54 positionTwoDefense
= new SendableChooser();
55 positionThreeDefense
= new SendableChooser();
56 positionFourDefense
= new SendableChooser();
57 positionFiveDefense
= new SendableChooser();
60 private void addPositionChooserOptions() {
61 positionChooser
.addDefault("Position 1", 1);
62 positionChooser
.addObject("Position 2", 2);
63 positionChooser
.addObject("Position 3", 3);
64 positionChooser
.addObject("Position 4", 4);
65 positionChooser
.addObject("Position 5", 5);
68 private void addDefensesToAllDefenseSendableChooosers() {
69 addDefenseOptions(positionOneDefense
);
70 addDefenseOptions(positionTwoDefense
);
71 addDefenseOptions(positionThreeDefense
);
72 addDefenseOptions(positionFourDefense
);
73 addDefenseOptions(positionFiveDefense
);
76 private void addDefenseOptions(SendableChooser chooser
) {
77 chooser
.addDefault("Portcullis", Defense
.PORTCULLIS
);
78 chooser
.addObject("Sally Port", Defense
.SALLY_PORT
);
79 chooser
.addObject("Rough Terrain", Defense
.ROUGH_TERRAIN
);
80 chooser
.addObject("Low Bar", Defense
.LOW_BAR
);
81 chooser
.addObject("Cheval De Frise", Defense
.CHEVAL_DE_FRISE
);
82 chooser
.addObject("Drawbridge", Defense
.DRAWBRIDGE
);
83 chooser
.addObject("Moat", Defense
.MOAT
);
84 chooser
.addObject("Rock Wall", Defense
.ROCK_WALL
);
87 private void sendSendableChoosersToSmartDashboard() {
88 SmartDashboard
.putData("PositionChooser", positionChooser
);
89 SmartDashboard
.putData("Position One Defense Chooser", positionOneDefense
);
90 SmartDashboard
.putData("Position Two Defense Chooser", positionTwoDefense
);
91 SmartDashboard
.putData("Position Three Defense Chooser",
92 positionThreeDefense
);
93 SmartDashboard
.putData("Position Four Defense Chooser",
95 SmartDashboard
.putData("Position Five Defense Chooser",
99 SmartDashboard
.putData("Position Four Defense Chooser",
100 positionFourDefense
);
101 SmartDashboard
.putData("Position Five Defense Chooser",
102 positionFiveDefense
);
104 shooter
= new Shooter();
105 >>>>>>> Initialize AnalogGyro in Robot
class
109 public void autonomousInit() {
110 Scheduler
.getInstance().run();
112 // get options chosen from drop down menu
113 Integer chosenPosition
= (Integer
) positionChooser
.getSelected();
114 Integer chosenDefense
= 0;
116 switch (chosenPosition
) {
118 chosenDefense
= (Integer
) positionOneDefense
.getSelected();
120 chosenDefense
= (Integer
) positionTwoDefense
.getSelected();
122 chosenDefense
= (Integer
) positionThreeDefense
.getSelected();
124 chosenDefense
= (Integer
) positionFourDefense
.getSelected();
126 chosenDefense
= (Integer
) positionFiveDefense
.getSelected();
129 System
.out
.println("Chosen Position: " + chosenPosition
);
130 System
.out
.println("Chosen Defense: " + chosenDefense
);
134 public void autonomousPeriodic() {
135 Scheduler
.getInstance().run();
139 public void teleopInit() {
140 Robot
.driveTrain
.initializeGyro();
144 public void teleopPeriodic() {
145 Scheduler
.getInstance().run();