remove position chooser and make one Sendable Chooser for the defense in front of...
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / Robot.java
1 package org.usfirst.frc.team3501.robot;
2
3 import org.usfirst.frc.team3501.robot.Constants.Auton;
4 import org.usfirst.frc.team3501.robot.Constants.Defense;
5 import org.usfirst.frc.team3501.robot.commands.auton.ChooseStrategy;
6 import org.usfirst.frc.team3501.robot.commands.driving.SetLowGear;
7 import org.usfirst.frc.team3501.robot.commands.intakearm.Photogate;
8 import org.usfirst.frc.team3501.robot.subsystems.DriveTrain;
9 import org.usfirst.frc.team3501.robot.subsystems.IntakeArm;
10 import org.usfirst.frc.team3501.robot.subsystems.Shooter;
11
12 import edu.wpi.first.wpilibj.IterativeRobot;
13 import edu.wpi.first.wpilibj.command.Scheduler;
14 import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
15 import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
16
17 public class Robot extends IterativeRobot {
18 public static OI oi;
19 public static DriveTrain driveTrain;
20 public static Shooter shooter;
21 public static IntakeArm intakeArm;
22 public static Photogate photogate;
23
24 // Sendable Choosers send a drop down menu to the Smart Dashboard.
25 SendableChooser defenseChooser;
26
27 @Override
28 public void robotInit() {
29 driveTrain = new DriveTrain();
30 shooter = new Shooter();
31 intakeArm = new IntakeArm();
32
33 oi = new OI();
34 photogate = new Photogate();
35
36 defenseChooser = new SendableChooser();
37 addDefenseOptions(defenseChooser);
38 SmartDashboard.putData("Defense Chooser", defenseChooser);
39 }
40
41 private void addDefenseOptions(SendableChooser chooser) {
42 chooser.addDefault("Portcullis", Defense.PORTCULLIS);
43 chooser.addObject("Sally Port", Defense.SALLY_PORT);
44 chooser.addObject("Rough Terrain" + Auton.ROUGH_TERRAIN_SPEED + " "
45 + Auton.ROUGH_TERRAIN_TIME, Defense.ROUGH_TERRAIN);
46 chooser.addObject("Low Bar" + " Will probably work...", Defense.LOW_BAR);
47 chooser.addObject("Chival De Frise", Defense.CHIVAL_DE_FRISE);
48 chooser.addObject("Drawbridge", Defense.DRAWBRIDGE);
49 chooser.addObject("Moat" + Auton.MOAT_SPEED + " " + Auton.MOAT_TIME,
50 Defense.MOAT);
51 chooser.addObject(
52 "Rock Wall" + Auton.ROCK_WALL_SPEED + " " + Auton.ROCK_WALL_TIME,
53 Defense.ROCK_WALL);
54 }
55
56 @Override
57 public void autonomousInit() {
58 Defense chosenDefense = (Defense) (defenseChooser.getSelected());
59
60 Scheduler.getInstance().add(new ChooseStrategy(chosenDefense));
61
62 // Scheduler.getInstance().add(new TimeDrive(.6, 4));
63 }
64
65 @Override
66 public void autonomousPeriodic() {
67 Scheduler.getInstance().run();
68 }
69
70 @Override
71 public void teleopInit() {
72 Scheduler.getInstance().add(new SetLowGear());
73 }
74
75 @Override
76 public void teleopPeriodic() {
77 Scheduler.getInstance().run();
78 }
79
80 }