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