1 package org
.usfirst
.frc
.team3501
.robot
;
3 import org
.usfirst
.frc
.team3501
.robot
.AnotherGyroClass
.Rotation
;
4 import org
.usfirst
.frc
.team3501
.robot
.Constants
.Defense
;
5 import org
.usfirst
.frc
.team3501
.robot
.subsystems
.DefenseArm
;
6 import org
.usfirst
.frc
.team3501
.robot
.subsystems
.DriveTrain
;
7 import org
.usfirst
.frc
.team3501
.robot
.subsystems
.IntakeArm
;
8 import org
.usfirst
.frc
.team3501
.robot
.subsystems
.Scaler
;
9 import org
.usfirst
.frc
.team3501
.robot
.subsystems
.Shooter
;
11 import edu
.wpi
.first
.wpilibj
.I2C
;
12 import edu
.wpi
.first
.wpilibj
.IterativeRobot
;
13 import edu
.wpi
.first
.wpilibj
.command
.Scheduler
;
14 import edu
.wpi
.first
.wpilibj
.smartdashboard
.SendableChooser
;
15 import edu
.wpi
.first
.wpilibj
.smartdashboard
.SmartDashboard
;
17 public class Robot
extends IterativeRobot
{
19 public static DriveTrain driveTrain
;
20 public static Shooter shooter
;
22 public static Scaler scaler
;
25 public static IntakeArm intakeArm
;
26 public static DefenseArm defenseArm
;
28 // Sendable Choosers send a drop down menu to the Smart Dashboard.
29 SendableChooser positionChooser
;
30 SendableChooser positionOneDefense
, positionTwoDefense
, positionThreeDefense
,
31 positionFourDefense
, positionFiveDefense
;
35 public AnotherGyroClass gyro
;
38 double degreesIncreased
;
44 public void robotInit() {
45 // driveTrain = new DriveTrain();
46 gyro
= new AnotherGyroClass(I2C
.Port
.kOnboard
, false);
49 shooter
= new Shooter();
50 scaler
= new Scaler();
51 intakeArm
= new IntakeArm();
53 // Sendable Choosers allows the driver to select the position of the
55 // and the positions of the defenses from a drop-down menu on the Smart
57 // make the Sendable Choosers
58 // initializeSendableChoosers();
59 // addPositionChooserOptions();
60 // addDefensesToAllDefenseSendableChooosers();
61 // sendSendableChoosersToSmartDashboard();
65 private void initializeSendableChoosers() {
66 positionChooser
= new SendableChooser();
67 positionOneDefense
= new SendableChooser();
68 positionTwoDefense
= new SendableChooser();
69 positionThreeDefense
= new SendableChooser();
70 positionFourDefense
= new SendableChooser();
71 positionFiveDefense
= new SendableChooser();
74 private void addPositionChooserOptions() {
75 positionChooser
.addDefault("Position 1", 1);
76 positionChooser
.addObject("Position 2", 2);
77 positionChooser
.addObject("Position 3", 3);
78 positionChooser
.addObject("Position 4", 4);
79 positionChooser
.addObject("Position 5", 5);
82 private void addDefensesToAllDefenseSendableChooosers() {
83 addDefenseOptions(positionOneDefense
);
84 addDefenseOptions(positionTwoDefense
);
85 addDefenseOptions(positionThreeDefense
);
86 addDefenseOptions(positionFourDefense
);
87 addDefenseOptions(positionFiveDefense
);
90 private void addDefenseOptions(SendableChooser chooser
) {
91 chooser
.addDefault("Portcullis", Defense
.PORTCULLIS
);
92 chooser
.addObject("Sally Port", Defense
.SALLY_PORT
);
93 chooser
.addObject("Rough Terrain", Defense
.ROUGH_TERRAIN
);
94 chooser
.addObject("Low Bar", Defense
.LOW_BAR
);
95 chooser
.addObject("Cheval De Frise", Defense
.CHEVAL_DE_FRISE
);
96 chooser
.addObject("Drawbridge", Defense
.DRAWBRIDGE
);
97 chooser
.addObject("Moat", Defense
.MOAT
);
98 chooser
.addObject("Rock Wall", Defense
.ROCK_WALL
);
101 private void sendSendableChoosersToSmartDashboard() {
102 SmartDashboard
.putData("PositionChooser", positionChooser
);
103 SmartDashboard
.putData("Position One Defense Chooser", positionOneDefense
);
104 SmartDashboard
.putData("Position Two Defense Chooser", positionTwoDefense
);
105 SmartDashboard
.putData("Position Three Defense Chooser",
106 positionThreeDefense
);
107 SmartDashboard
.putData("Position Four Defense Chooser",
108 positionFourDefense
);
109 SmartDashboard
.putData("Position Five Defense Chooser",
110 positionFiveDefense
);
112 SmartDashboard
.putData("Position Four Defense Chooser",
113 positionFourDefense
);
114 SmartDashboard
.putData("Position Five Defense Chooser",
115 positionFiveDefense
);
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();