Commit | Line | Data |
---|---|---|
38a404b3 KZ |
1 | package org.usfirst.frc.team3501.robot; |
2 | ||
53d61b3e | 3 | import org.usfirst.frc.team3501.robot.Constants.Defense; |
4f03bb55 | 4 | import org.usfirst.frc.team3501.robot.commands.driving.DriveDistance; |
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 | ||
38a404b3 KZ |
11 | import edu.wpi.first.wpilibj.IterativeRobot; |
12 | import edu.wpi.first.wpilibj.command.Scheduler; | |
3366a59a ME |
13 | import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; |
14 | import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; | |
38a404b3 KZ |
15 | |
16 | public class Robot extends IterativeRobot { | |
17 | public static OI oi; | |
18 | public static DriveTrain driveTrain; | |
40348cab | 19 | public static Shooter shooter; |
2c9f5abb | 20 | |
02cb494e | 21 | public static Scaler scaler; |
c97fbce2 | 22 | |
a96fa926 | 23 | public static IntakeArm intakeArm; |
200caf63 | 24 | public static DefenseArm defenseArm; |
38a404b3 | 25 | |
88e66b4e | 26 | // Sendable Choosers send a drop down menu to the Smart Dashboard. |
3366a59a | 27 | SendableChooser positionChooser; |
6947c8a4 | 28 | SendableChooser positionOneDefense, positionTwoDefense, positionThreeDefense, |
4f03bb55 | 29 | positionFourDefense, positionFiveDefense; |
3366a59a | 30 | |
38a404b3 KZ |
31 | @Override |
32 | public void robotInit() { | |
9742fe2e KZ |
33 | driveTrain = new DriveTrain(); |
34 | oi = new OI(); | |
2ac0cc17 | 35 | |
4f03bb55 CZ |
36 | // shooter = new Shooter(); |
37 | // scaler = new Scaler(); | |
38 | // intakeArm = new IntakeArm(); | |
39 | // | |
40 | // initializeSendableChoosers(); | |
41 | // addPositionChooserOptions(); | |
42 | // addDefensesToAllDefenseSendableChoosers(); | |
43 | // sendSendableChoosersToSmartDashboard(); | |
9742fe2e | 44 | |
3366a59a ME |
45 | } |
46 | ||
6947c8a4 ME |
47 | private void initializeSendableChoosers() { |
48 | positionChooser = new SendableChooser(); | |
49 | positionOneDefense = new SendableChooser(); | |
50 | positionTwoDefense = new SendableChooser(); | |
51 | positionThreeDefense = new SendableChooser(); | |
52 | positionFourDefense = new SendableChooser(); | |
53 | positionFiveDefense = new SendableChooser(); | |
54 | } | |
55 | ||
29d59f48 ME |
56 | private void addPositionChooserOptions() { |
57 | positionChooser.addDefault("Position 1", 1); | |
58 | positionChooser.addObject("Position 2", 2); | |
59 | positionChooser.addObject("Position 3", 3); | |
60 | positionChooser.addObject("Position 4", 4); | |
61 | positionChooser.addObject("Position 5", 5); | |
62 | } | |
63 | ||
9742fe2e | 64 | private void addDefensesToAllDefenseSendableChoosers() { |
29d59f48 ME |
65 | addDefenseOptions(positionOneDefense); |
66 | addDefenseOptions(positionTwoDefense); | |
67 | addDefenseOptions(positionThreeDefense); | |
68 | addDefenseOptions(positionFourDefense); | |
69 | addDefenseOptions(positionFiveDefense); | |
70 | } | |
71 | ||
72 | private void addDefenseOptions(SendableChooser chooser) { | |
3366a59a ME |
73 | chooser.addDefault("Portcullis", Defense.PORTCULLIS); |
74 | chooser.addObject("Sally Port", Defense.SALLY_PORT); | |
75 | chooser.addObject("Rough Terrain", Defense.ROUGH_TERRAIN); | |
76 | chooser.addObject("Low Bar", Defense.LOW_BAR); | |
77 | chooser.addObject("Cheval De Frise", Defense.CHEVAL_DE_FRISE); | |
78 | chooser.addObject("Drawbridge", Defense.DRAWBRIDGE); | |
79 | chooser.addObject("Moat", Defense.MOAT); | |
80 | chooser.addObject("Rock Wall", Defense.ROCK_WALL); | |
38a404b3 KZ |
81 | } |
82 | ||
29d59f48 ME |
83 | private void sendSendableChoosersToSmartDashboard() { |
84 | SmartDashboard.putData("PositionChooser", positionChooser); | |
85 | SmartDashboard.putData("Position One Defense Chooser", positionOneDefense); | |
86 | SmartDashboard.putData("Position Two Defense Chooser", positionTwoDefense); | |
87 | SmartDashboard.putData("Position Three Defense Chooser", | |
88 | positionThreeDefense); | |
e23bfd98 E |
89 | SmartDashboard.putData("Position Four Defense Chooser", |
90 | positionFourDefense); | |
91 | SmartDashboard.putData("Position Five Defense Chooser", | |
92 | positionFiveDefense); | |
d06ee698 | 93 | |
e23bfd98 E |
94 | SmartDashboard.putData("Position Four Defense Chooser", |
95 | positionFourDefense); | |
96 | SmartDashboard.putData("Position Five Defense Chooser", | |
97 | positionFiveDefense); | |
98 | ||
99 | shooter = new Shooter(); | |
d06ee698 | 100 | |
29d59f48 ME |
101 | } |
102 | ||
38a404b3 KZ |
103 | @Override |
104 | public void autonomousInit() { | |
3366a59a ME |
105 | Scheduler.getInstance().run(); |
106 | ||
4f03bb55 CZ |
107 | // // get options chosen from drop down menu |
108 | // Integer chosenPosition = (Integer) positionChooser.getSelected(); | |
109 | // Integer chosenDefense = 0; | |
110 | // | |
111 | // if (chosenPosition == 1) | |
112 | // chosenDefense = (Integer) positionOneDefense.getSelected(); | |
113 | // else if (chosenPosition == 2) | |
114 | // chosenDefense = (Integer) positionTwoDefense.getSelected(); | |
115 | // else if (chosenPosition == 3) | |
116 | // chosenDefense = (Integer) positionThreeDefense.getSelected(); | |
117 | // else if (chosenPosition == 4) | |
118 | // chosenDefense = (Integer) positionFourDefense.getSelected(); | |
119 | // else if (chosenPosition == 5) | |
120 | // chosenDefense = (Integer) positionFiveDefense.getSelected(); | |
121 | // | |
122 | // System.out.println("Chosen Position: " + chosenPosition); | |
123 | // System.out.println("Chosen Defense: " + chosenDefense); | |
38a404b3 KZ |
124 | } |
125 | ||
126 | @Override | |
127 | public void autonomousPeriodic() { | |
128 | Scheduler.getInstance().run(); | |
38a404b3 KZ |
129 | } |
130 | ||
131 | @Override | |
132 | public void teleopInit() { | |
4f03bb55 CZ |
133 | Scheduler.getInstance().add(new DriveDistance(24, 5)); |
134 | // Scheduler.getInstance().add(new DriveForTime(2, 0.3)); | |
135 | // Scheduler.getInstance().add(new TurnForAngle(90, 5)); | |
136 | // Scheduler.getInstance().add( | |
137 | // new TurnForTime(3, Constants.Direction.RIGHT, 0.3)); | |
138 | // Scheduler.getInstance().add( | |
139 | // new TurnForTime(3, Constants.Direction.LEFT, 0.3)); | |
140 | // Scheduler.getInstance().add(new JoystickDrive()); | |
141 | // Scheduler.getInstance().add(new Turn180()); | |
38a404b3 KZ |
142 | } |
143 | ||
144 | @Override | |
145 | public void teleopPeriodic() { | |
146 | Scheduler.getInstance().run(); | |
1e039ebd E |
147 | } |
148 | ||
38a404b3 | 149 | } |