Commit | Line | Data |
---|---|---|
38a404b3 KZ |
1 | package org.usfirst.frc.team3501.robot; |
2 | ||
1e039ebd | 3 | import org.usfirst.frc.team3501.robot.AnotherGyroClass.Rotation; |
53d61b3e | 4 | import org.usfirst.frc.team3501.robot.Constants.Defense; |
2947642e | 5 | import org.usfirst.frc.team3501.robot.subsystems.DefenseArm; |
047383c3 | 6 | import org.usfirst.frc.team3501.robot.subsystems.DriveTrain; |
e47f0862 | 7 | import org.usfirst.frc.team3501.robot.subsystems.IntakeArm; |
02cb494e | 8 | import org.usfirst.frc.team3501.robot.subsystems.Scaler; |
40348cab E |
9 | import org.usfirst.frc.team3501.robot.subsystems.Shooter; |
10 | ||
c97fbce2 | 11 | import edu.wpi.first.wpilibj.I2C; |
38a404b3 KZ |
12 | import edu.wpi.first.wpilibj.IterativeRobot; |
13 | import edu.wpi.first.wpilibj.command.Scheduler; | |
3366a59a ME |
14 | import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; |
15 | import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; | |
38a404b3 KZ |
16 | |
17 | public class Robot extends IterativeRobot { | |
18 | public static OI oi; | |
19 | public static DriveTrain driveTrain; | |
40348cab | 20 | public static Shooter shooter; |
2c9f5abb | 21 | |
02cb494e | 22 | public static Scaler scaler; |
1e039ebd | 23 | double then; |
c97fbce2 | 24 | |
a96fa926 | 25 | public static IntakeArm intakeArm; |
200caf63 | 26 | public static DefenseArm defenseArm; |
38a404b3 | 27 | |
88e66b4e | 28 | // Sendable Choosers send a drop down menu to the Smart Dashboard. |
3366a59a | 29 | SendableChooser positionChooser; |
6947c8a4 | 30 | SendableChooser positionOneDefense, positionTwoDefense, positionThreeDefense, |
e23bfd98 | 31 | positionFourDefense, positionFiveDefense; |
3366a59a | 32 | |
c97fbce2 | 33 | // Gyro stuff |
c97fbce2 | 34 | short rawValue; |
62b40620 | 35 | public AnotherGyroClass gyro; |
c97fbce2 | 36 | |
1e039ebd | 37 | double now; |
d06ee698 | 38 | double degreesIncreased; |
c97fbce2 E |
39 | double degrees; |
40 | ||
1e039ebd E |
41 | Rotation rotation; |
42 | ||
38a404b3 KZ |
43 | @Override |
44 | public void robotInit() { | |
c97fbce2 | 45 | // driveTrain = new DriveTrain(); |
62b40620 | 46 | gyro = new AnotherGyroClass(I2C.Port.kOnboard, false); |
c97fbce2 | 47 | // oi = new OI(); |
2ac0cc17 | 48 | |
40348cab | 49 | shooter = new Shooter(); |
02cb494e | 50 | scaler = new Scaler(); |
a96fa926 | 51 | intakeArm = new IntakeArm(); |
3366a59a | 52 | |
a96fa926 D |
53 | // Sendable Choosers allows the driver to select the position of the |
54 | // robot | |
88e66b4e ME |
55 | // and the positions of the defenses from a drop-down menu on the Smart |
56 | // Dashboard | |
29d59f48 | 57 | // make the Sendable Choosers |
d06ee698 E |
58 | // initializeSendableChoosers(); |
59 | // addPositionChooserOptions(); | |
60 | // addDefensesToAllDefenseSendableChooosers(); | |
61 | // sendSendableChoosersToSmartDashboard(); | |
29d59f48 | 62 | |
3366a59a ME |
63 | } |
64 | ||
6947c8a4 ME |
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(); | |
72 | } | |
73 | ||
29d59f48 ME |
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); | |
80 | } | |
81 | ||
82 | private void addDefensesToAllDefenseSendableChooosers() { | |
83 | addDefenseOptions(positionOneDefense); | |
84 | addDefenseOptions(positionTwoDefense); | |
85 | addDefenseOptions(positionThreeDefense); | |
86 | addDefenseOptions(positionFourDefense); | |
87 | addDefenseOptions(positionFiveDefense); | |
88 | } | |
89 | ||
90 | private void addDefenseOptions(SendableChooser chooser) { | |
3366a59a ME |
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); | |
38a404b3 KZ |
99 | } |
100 | ||
29d59f48 ME |
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); | |
e23bfd98 E |
107 | SmartDashboard.putData("Position Four Defense Chooser", |
108 | positionFourDefense); | |
109 | SmartDashboard.putData("Position Five Defense Chooser", | |
110 | positionFiveDefense); | |
d06ee698 | 111 | |
e23bfd98 E |
112 | SmartDashboard.putData("Position Four Defense Chooser", |
113 | positionFourDefense); | |
114 | SmartDashboard.putData("Position Five Defense Chooser", | |
115 | positionFiveDefense); | |
116 | ||
117 | shooter = new Shooter(); | |
d06ee698 | 118 | |
29d59f48 ME |
119 | } |
120 | ||
38a404b3 KZ |
121 | @Override |
122 | public void autonomousInit() { | |
3366a59a ME |
123 | Scheduler.getInstance().run(); |
124 | ||
125 | // get options chosen from drop down menu | |
126 | Integer chosenPosition = (Integer) positionChooser.getSelected(); | |
e13d2293 | 127 | Integer chosenDefense = 0; |
3366a59a | 128 | |
33981335 ME |
129 | switch (chosenPosition) { |
130 | case 1: | |
3366a59a | 131 | chosenDefense = (Integer) positionOneDefense.getSelected(); |
33981335 | 132 | case 2: |
3366a59a | 133 | chosenDefense = (Integer) positionTwoDefense.getSelected(); |
33981335 | 134 | case 3: |
3366a59a | 135 | chosenDefense = (Integer) positionThreeDefense.getSelected(); |
33981335 | 136 | case 4: |
3366a59a | 137 | chosenDefense = (Integer) positionFourDefense.getSelected(); |
33981335 | 138 | case 5: |
3366a59a | 139 | chosenDefense = (Integer) positionFiveDefense.getSelected(); |
33981335 | 140 | } |
3366a59a ME |
141 | |
142 | System.out.println("Chosen Position: " + chosenPosition); | |
143 | System.out.println("Chosen Defense: " + chosenDefense); | |
38a404b3 KZ |
144 | } |
145 | ||
146 | @Override | |
147 | public void autonomousPeriodic() { | |
148 | Scheduler.getInstance().run(); | |
38a404b3 KZ |
149 | } |
150 | ||
151 | @Override | |
152 | public void teleopInit() { | |
153 | } | |
154 | ||
155 | @Override | |
156 | public void teleopPeriodic() { | |
157 | Scheduler.getInstance().run(); | |
1e039ebd E |
158 | |
159 | } | |
160 | ||
38a404b3 | 161 | } |