Commit | Line | Data |
---|---|---|
38a404b3 KZ |
1 | package org.usfirst.frc.team3501.robot; |
2 | ||
9e9154af HD |
3 | import org.usfirst.frc.team3501.robot.Constants.Defense; |
4 | import org.usfirst.frc.team3501.robot.commands.auton.ChooseStrategy; | |
eeb6c3d9 | 5 | import org.usfirst.frc.team3501.robot.commands.driving.SetLowGear; |
e2c4d3a5 | 6 | import org.usfirst.frc.team3501.robot.commands.intakearm.Photogate; |
047383c3 | 7 | import org.usfirst.frc.team3501.robot.subsystems.DriveTrain; |
e47f0862 | 8 | import org.usfirst.frc.team3501.robot.subsystems.IntakeArm; |
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; | |
9e9154af HD |
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; |
a96fa926 | 20 | public static IntakeArm intakeArm; |
e2c4d3a5 | 21 | public static Photogate photogate; |
7236fc11 | 22 | public static CameraFeeds cameraFeeds; |
3366a59a | 23 | |
9e9154af | 24 | // Sendable Choosers send a drop down menu to the Smart Dashboard. |
157ea726 ME |
25 | private static SendableChooser defenseChooser; |
26 | private static SendableChooser frontChooser; | |
27 | boolean choseIntakeIsFront; | |
9e9154af | 28 | |
38a404b3 KZ |
29 | @Override |
30 | public void robotInit() { | |
9742fe2e | 31 | driveTrain = new DriveTrain(); |
40348cab | 32 | shooter = new Shooter(); |
a96fa926 | 33 | intakeArm = new IntakeArm(); |
f675bae4 | 34 | photogate = new Photogate(); |
7236fc11 | 35 | cameraFeeds = new CameraFeeds(); |
fab544eb HD |
36 | |
37 | oi = new OI(); | |
9e9154af | 38 | |
de0cd1ce ME |
39 | defenseChooser = new SendableChooser(); |
40 | addDefenseOptions(defenseChooser); | |
41 | SmartDashboard.putData("Defense Chooser", defenseChooser); | |
157ea726 ME |
42 | |
43 | frontChooser = new SendableChooser(); | |
44 | addFrontChooserOptions(); | |
45 | SmartDashboard.putData("Front Chooser", frontChooser); | |
46 | } | |
47 | ||
48 | private void addFrontChooserOptions() { | |
49 | frontChooser.addDefault("Intake is Back", false); | |
50 | frontChooser.addObject("Intake is True", true); | |
9e9154af HD |
51 | } |
52 | ||
53 | private void addDefenseOptions(SendableChooser chooser) { | |
54 | chooser.addDefault("Portcullis", Defense.PORTCULLIS); | |
55 | chooser.addObject("Sally Port", Defense.SALLY_PORT); | |
f675bae4 HD |
56 | chooser.addObject("Rough Terrain", Defense.ROUGH_TERRAIN); |
57 | chooser.addObject("Low Bar", Defense.LOW_BAR); | |
9e9154af HD |
58 | chooser.addObject("Chival De Frise", Defense.CHIVAL_DE_FRISE); |
59 | chooser.addObject("Drawbridge", Defense.DRAWBRIDGE); | |
f675bae4 HD |
60 | chooser.addObject("Moat", Defense.MOAT); |
61 | chooser.addObject("Rock Wall", Defense.ROCK_WALL); | |
c62f7132 | 62 | chooser.addObject("No Auton", Defense.NONE); |
29d59f48 ME |
63 | } |
64 | ||
38a404b3 KZ |
65 | @Override |
66 | public void autonomousInit() { | |
de0cd1ce | 67 | Defense chosenDefense = (Defense) (defenseChooser.getSelected()); |
157ea726 ME |
68 | choseIntakeIsFront = (boolean) frontChooser.getSelected(); |
69 | ||
70 | // if the shooter is not the front (intake is front) - toggle the drivetrain | |
71 | if (choseIntakeIsFront) | |
72 | driveTrain.toggleFlipped(); | |
9e9154af | 73 | |
de0cd1ce | 74 | Scheduler.getInstance().add(new ChooseStrategy(chosenDefense)); |
35e19c59 HD |
75 | |
76 | // Scheduler.getInstance().add(new TimeDrive(.6, 4)); | |
157ea726 | 77 | |
38a404b3 KZ |
78 | } |
79 | ||
80 | @Override | |
81 | public void autonomousPeriodic() { | |
82 | Scheduler.getInstance().run(); | |
38a404b3 KZ |
83 | } |
84 | ||
85 | @Override | |
86 | public void teleopInit() { | |
157ea726 | 87 | // if intake is front, switch back to shooter as front |
7236fc11 | 88 | // this is done on purpose! |
157ea726 ME |
89 | if (choseIntakeIsFront) |
90 | driveTrain.toggleFlipped(); | |
91 | ||
7236fc11 | 92 | cameraFeeds.init(); |
eeb6c3d9 | 93 | Scheduler.getInstance().add(new SetLowGear()); |
38a404b3 KZ |
94 | } |
95 | ||
96 | @Override | |
97 | public void teleopPeriodic() { | |
98 | Scheduler.getInstance().run(); | |
7236fc11 | 99 | cameraFeeds.run(); |
1e039ebd E |
100 | } |
101 | ||
38a404b3 | 102 | } |