1 package org
.usfirst
.frc
.team3501
.robot
;
3 import org
.usfirst
.frc
.team3501
.robot
.Constants
.Defense
;
4 import org
.usfirst
.frc
.team3501
.robot
.commands
.auton
.ChooseStrategy
;
5 import org
.usfirst
.frc
.team3501
.robot
.commands
.driving
.SetLowGear
;
6 import org
.usfirst
.frc
.team3501
.robot
.commands
.intakearm
.Photogate
;
7 import org
.usfirst
.frc
.team3501
.robot
.subsystems
.DriveTrain
;
8 import org
.usfirst
.frc
.team3501
.robot
.subsystems
.IntakeArm
;
9 import org
.usfirst
.frc
.team3501
.robot
.subsystems
.Shooter
;
11 import edu
.wpi
.first
.wpilibj
.IterativeRobot
;
12 import edu
.wpi
.first
.wpilibj
.command
.Scheduler
;
13 import edu
.wpi
.first
.wpilibj
.smartdashboard
.SendableChooser
;
14 import edu
.wpi
.first
.wpilibj
.smartdashboard
.SmartDashboard
;
16 public class Robot
extends IterativeRobot
{
18 public static DriveTrain driveTrain
;
19 public static Shooter shooter
;
20 public static IntakeArm intakeArm
;
21 public static Photogate photogate
;
23 // Sendable Choosers send a drop down menu to the Smart Dashboard.
24 private static SendableChooser defenseChooser
;
25 private static SendableChooser frontChooser
;
26 boolean choseIntakeIsFront
;
29 public void robotInit() {
30 driveTrain
= new DriveTrain();
31 shooter
= new Shooter();
32 intakeArm
= new IntakeArm();
33 photogate
= new Photogate();
37 defenseChooser
= new SendableChooser();
38 addDefenseOptions(defenseChooser
);
39 SmartDashboard
.putData("Defense Chooser", defenseChooser
);
41 frontChooser
= new SendableChooser();
42 addFrontChooserOptions();
43 SmartDashboard
.putData("Front Chooser", frontChooser
);
46 private void addFrontChooserOptions() {
47 frontChooser
.addDefault("Intake is Back", false);
48 frontChooser
.addObject("Intake is True", true);
51 private void addDefenseOptions(SendableChooser chooser
) {
52 chooser
.addDefault("Portcullis", Defense
.PORTCULLIS
);
53 chooser
.addObject("Sally Port", Defense
.SALLY_PORT
);
54 chooser
.addObject("Rough Terrain", Defense
.ROUGH_TERRAIN
);
55 chooser
.addObject("Low Bar", Defense
.LOW_BAR
);
56 chooser
.addObject("Chival De Frise", Defense
.CHIVAL_DE_FRISE
);
57 chooser
.addObject("Drawbridge", Defense
.DRAWBRIDGE
);
58 chooser
.addObject("Moat", Defense
.MOAT
);
59 chooser
.addObject("Rock Wall", Defense
.ROCK_WALL
);
60 chooser
.addObject("No Auton", Defense
.NONE
);
64 public void autonomousInit() {
65 Defense chosenDefense
= (Defense
) (defenseChooser
.getSelected());
66 choseIntakeIsFront
= (boolean) frontChooser
.getSelected();
68 // if the shooter is not the front (intake is front) - toggle the drivetrain
69 if (choseIntakeIsFront
)
70 driveTrain
.toggleFlipped();
72 Scheduler
.getInstance().add(new ChooseStrategy(chosenDefense
));
74 // Scheduler.getInstance().add(new TimeDrive(.6, 4));
79 public void autonomousPeriodic() {
80 Scheduler
.getInstance().run();
84 public void teleopInit() {
85 // if intake is front, switch back to shooter as front
86 if (choseIntakeIsFront
)
87 driveTrain
.toggleFlipped();
89 Scheduler
.getInstance().add(new SetLowGear());
93 public void teleopPeriodic() {
94 Scheduler
.getInstance().run();