1 package org
.usfirst
.frc
.team3501
.robot
;
3 import org
.usfirst
.frc
.team3501
.robot
.Constants
.DriveTrain
;
4 import org
.usfirst
.frc
.team3501
.robot
.subsystems
.Shooter
;
6 import edu
.wpi
.first
.wpilibj
.IterativeRobot
;
7 import edu
.wpi
.first
.wpilibj
.command
.Scheduler
;
8 import edu
.wpi
.first
.wpilibj
.smartdashboard
.SendableChooser
;
9 import edu
.wpi
.first
.wpilibj
.smartdashboard
.SmartDashboard
;
11 public class Robot
extends IterativeRobot
{
13 public static DriveTrain driveTrain
;
14 public static Shooter shooter
;
17 PORTCULLIS
, SALLY_PORT
, ROUGH_TERRAIN
, LOW_BAR
, CHEVAL_DE_FRISE
, DRAWBRIDGE
, MOAT
, ROCK_WALL
20 SendableChooser positionOneDefense
;
21 SendableChooser positionTwoDefense
;
22 SendableChooser positionThreeDefense
;
23 SendableChooser positionFourDefense
;
24 SendableChooser positionFiveDefense
;
25 SendableChooser positionChooser
;
28 public void robotInit() {
29 driveTrain
= new DriveTrain();
31 shooter
= new Shooter();
33 // intialize all the Sendable Choosers
34 positionChooser
= new SendableChooser();
35 positionOneDefense
= new SendableChooser();
36 positionTwoDefense
= new SendableChooser();
37 positionThreeDefense
= new SendableChooser();
38 positionFourDefense
= new SendableChooser();
39 positionFiveDefense
= new SendableChooser();
41 // add options for positions to the positionChooser
42 positionChooser
.addDefault("Position 1", 1);
43 positionChooser
.addObject("Position 2", 2);
44 positionChooser
.addObject("Position 3", 3);
45 positionChooser
.addObject("Position 4", 4);
46 positionChooser
.addObject("Position 5", 5);
48 // add options for defenses into each defense chooser (5)
49 addDefense(positionOneDefense
);
50 addDefense(positionTwoDefense
);
51 addDefense(positionThreeDefense
);
52 addDefense(positionFourDefense
);
53 addDefense(positionFiveDefense
);
55 SmartDashboard
.putData("Position", positionChooser
);
56 SmartDashboard
.putData("Position One Defense", positionOneDefense
);
57 SmartDashboard
.putData("Position Two Defense", positionTwoDefense
);
58 SmartDashboard
.putData("Position Three Defense", positionThreeDefense
);
59 SmartDashboard
.putData("Position Four Defense", positionFourDefense
);
60 SmartDashboard
.putData("Position Five Defense", positionFiveDefense
);
64 private void addDefense(SendableChooser chooser
) {
65 chooser
.addDefault("Portcullis", Defense
.PORTCULLIS
);
66 chooser
.addObject("Sally Port", Defense
.SALLY_PORT
);
67 chooser
.addObject("Rough Terrain", Defense
.ROUGH_TERRAIN
);
68 chooser
.addObject("Low Bar", Defense
.LOW_BAR
);
69 chooser
.addObject("Cheval De Frise", Defense
.CHEVAL_DE_FRISE
);
70 chooser
.addObject("Drawbridge", Defense
.DRAWBRIDGE
);
71 chooser
.addObject("Moat", Defense
.MOAT
);
72 chooser
.addObject("Rock Wall", Defense
.ROCK_WALL
);
76 public void autonomousInit() {
77 Scheduler
.getInstance().run();
79 // get options chosen from drop down menu
80 Integer chosenPosition
= (Integer
) positionChooser
.getSelected();
81 Integer chosenDefense
= -1;
83 if (chosenPosition
== 1)
84 chosenDefense
= (Integer
) positionOneDefense
.getSelected();
85 if (chosenPosition
== 2)
86 chosenDefense
= (Integer
) positionTwoDefense
.getSelected();
87 if (chosenPosition
== 3)
88 chosenDefense
= (Integer
) positionThreeDefense
.getSelected();
89 if (chosenPosition
== 4)
90 chosenDefense
= (Integer
) positionFourDefense
.getSelected();
91 if (chosenPosition
== 5)
92 chosenDefense
= (Integer
) positionFiveDefense
.getSelected();
94 System
.out
.println("Chosen Position: " + chosenPosition
);
95 System
.out
.println("Chosen Defense: " + chosenDefense
);
99 public void autonomousPeriodic() {
100 Scheduler
.getInstance().run();
104 public void teleopInit() {
105 System
.out
.println("running teleopInit");
109 public void teleopPeriodic() {
110 Scheduler
.getInstance().run();
114 public void operate() {