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 // send the Sendable Choosers to the Smart Dashboard
56 SmartDashboard
.putData("PositionChooser", positionChooser
);
57 SmartDashboard
.putData("Position One Defense Chooser", positionOneDefense
);
58 SmartDashboard
.putData("Position Two Defense Chooser", positionTwoDefense
);
59 SmartDashboard
.putData("Position Three Defense Chooser",
60 positionThreeDefense
);
61 SmartDashboard
.putData("Position Four Defense Chooser",
63 SmartDashboard
.putData("Position Five Defense Chooser",
67 private void addDefense(SendableChooser chooser
) {
68 chooser
.addDefault("Portcullis", Defense
.PORTCULLIS
);
69 chooser
.addObject("Sally Port", Defense
.SALLY_PORT
);
70 chooser
.addObject("Rough Terrain", Defense
.ROUGH_TERRAIN
);
71 chooser
.addObject("Low Bar", Defense
.LOW_BAR
);
72 chooser
.addObject("Cheval De Frise", Defense
.CHEVAL_DE_FRISE
);
73 chooser
.addObject("Drawbridge", Defense
.DRAWBRIDGE
);
74 chooser
.addObject("Moat", Defense
.MOAT
);
75 chooser
.addObject("Rock Wall", Defense
.ROCK_WALL
);
79 public void autonomousInit() {
80 Scheduler
.getInstance().run();
82 // get options chosen from drop down menu
83 Integer chosenPosition
= (Integer
) positionChooser
.getSelected();
84 Integer chosenDefense
= 0;
86 if (chosenPosition
== 1)
87 chosenDefense
= (Integer
) positionOneDefense
.getSelected();
88 if (chosenPosition
== 2)
89 chosenDefense
= (Integer
) positionTwoDefense
.getSelected();
90 if (chosenPosition
== 3)
91 chosenDefense
= (Integer
) positionThreeDefense
.getSelected();
92 if (chosenPosition
== 4)
93 chosenDefense
= (Integer
) positionFourDefense
.getSelected();
94 if (chosenPosition
== 5)
95 chosenDefense
= (Integer
) positionFiveDefense
.getSelected();
97 System
.out
.println("Chosen Position: " + chosenPosition
);
98 System
.out
.println("Chosen Defense: " + chosenDefense
);
102 public void autonomousPeriodic() {
103 Scheduler
.getInstance().run();
107 public void teleopInit() {
108 System
.out
.println("running teleopInit");
112 public void teleopPeriodic() {
113 Scheduler
.getInstance().run();
117 public void operate() {