Commit | Line | Data |
---|---|---|
38a404b3 KZ |
1 | package org.usfirst.frc.team3501.robot; |
2 | ||
53d61b3e | 3 | import org.usfirst.frc.team3501.robot.Constants.Defense; |
a28e24c7 | 4 | import org.usfirst.frc.team3501.robot.commands.driving.JoystickDrive; |
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 | ||
b3bdd589 | 11 | import edu.wpi.first.wpilibj.Compressor; |
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; |
c97fbce2 | 23 | |
a96fa926 | 24 | public static IntakeArm intakeArm; |
200caf63 | 25 | public static DefenseArm defenseArm; |
38a404b3 | 26 | |
b3bdd589 KZ |
27 | public static Compressor compressor; |
28 | ||
88e66b4e | 29 | // Sendable Choosers send a drop down menu to the Smart Dashboard. |
3366a59a | 30 | SendableChooser positionChooser; |
6947c8a4 | 31 | SendableChooser positionOneDefense, positionTwoDefense, positionThreeDefense, |
b3bdd589 | 32 | positionFourDefense, positionFiveDefense; |
3366a59a | 33 | |
38a404b3 KZ |
34 | @Override |
35 | public void robotInit() { | |
9742fe2e KZ |
36 | driveTrain = new DriveTrain(); |
37 | oi = new OI(); | |
2ac0cc17 | 38 | |
4f03bb55 CZ |
39 | // shooter = new Shooter(); |
40 | // scaler = new Scaler(); | |
41 | // intakeArm = new IntakeArm(); | |
42 | // | |
43 | // initializeSendableChoosers(); | |
44 | // addPositionChooserOptions(); | |
45 | // addDefensesToAllDefenseSendableChoosers(); | |
46 | // sendSendableChoosersToSmartDashboard(); | |
b3bdd589 | 47 | compressor = new Compressor(); |
9742fe2e | 48 | |
3366a59a ME |
49 | } |
50 | ||
6947c8a4 ME |
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(); | |
58 | } | |
59 | ||
29d59f48 ME |
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); | |
66 | } | |
67 | ||
9742fe2e | 68 | private void addDefensesToAllDefenseSendableChoosers() { |
29d59f48 ME |
69 | addDefenseOptions(positionOneDefense); |
70 | addDefenseOptions(positionTwoDefense); | |
71 | addDefenseOptions(positionThreeDefense); | |
72 | addDefenseOptions(positionFourDefense); | |
73 | addDefenseOptions(positionFiveDefense); | |
74 | } | |
75 | ||
76 | private void addDefenseOptions(SendableChooser chooser) { | |
3366a59a ME |
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); | |
38a404b3 KZ |
85 | } |
86 | ||
29d59f48 ME |
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); | |
e23bfd98 E |
93 | SmartDashboard.putData("Position Four Defense Chooser", |
94 | positionFourDefense); | |
95 | SmartDashboard.putData("Position Five Defense Chooser", | |
96 | positionFiveDefense); | |
d06ee698 | 97 | |
e23bfd98 E |
98 | SmartDashboard.putData("Position Four Defense Chooser", |
99 | positionFourDefense); | |
100 | SmartDashboard.putData("Position Five Defense Chooser", | |
101 | positionFiveDefense); | |
102 | ||
103 | shooter = new Shooter(); | |
d06ee698 | 104 | |
29d59f48 ME |
105 | } |
106 | ||
38a404b3 KZ |
107 | @Override |
108 | public void autonomousInit() { | |
3366a59a ME |
109 | Scheduler.getInstance().run(); |
110 | ||
c442f9db | 111 | // Scheduler.getInstance().add(new DriveDistance(24, 5)); |
4f03bb55 CZ |
112 | // Scheduler.getInstance().add(new DriveForTime(2, 0.3)); |
113 | // Scheduler.getInstance().add(new TurnForAngle(90, 5)); | |
114 | // Scheduler.getInstance().add( | |
115 | // new TurnForTime(3, Constants.Direction.RIGHT, 0.3)); | |
116 | // Scheduler.getInstance().add( | |
117 | // new TurnForTime(3, Constants.Direction.LEFT, 0.3)); | |
4f03bb55 | 118 | // Scheduler.getInstance().add(new Turn180()); |
38a404b3 KZ |
119 | } |
120 | ||
6c72e0a8 KZ |
121 | @Override |
122 | public void autonomousPeriodic() { | |
123 | Scheduler.getInstance().run(); | |
124 | } | |
125 | ||
c442f9db CZ |
126 | @Override |
127 | public void teleopInit() { | |
c442f9db | 128 | |
b3bdd589 KZ |
129 | Scheduler.getInstance().add(new JoystickDrive()); |
130 | compressor.start(); | |
131 | driveTrain.leftGearPiston.set(Constants.DriveTrain.HIGH_GEAR); | |
132 | driveTrain.rightGearPiston.set(Constants.DriveTrain.HIGH_GEAR); | |
c442f9db CZ |
133 | } |
134 | ||
38a404b3 KZ |
135 | @Override |
136 | public void teleopPeriodic() { | |
137 | Scheduler.getInstance().run(); | |
1e039ebd E |
138 | } |
139 | ||
38a404b3 | 140 | } |