1+ /*----------------------------------------------------------------------------*/
2+ /* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
3+ /* Open Source Software - may be modified and shared by FRC teams. The code */
4+ /* must be accompanied by the FIRST BSD license file in the root directory of */
5+ /* the project. */
6+ /*----------------------------------------------------------------------------*/
17
28package org .usfirst .frc .team199 .Robot2018 ;
39
@@ -41,13 +47,13 @@ public class Robot extends TimedRobot {
4147 public static Listener listen ;
4248
4349 public static OI oi ;
44-
50+
4551 public static Map <String , ArrayList <String []>> autoScripts ;
4652
4753 Command autonomousCommand ;
4854 SendableChooser <Position > posChooser = new SendableChooser <Position >();
4955 Map <String , SendableChooser <Strategy >> stratChoosers = new HashMap <String , SendableChooser <Strategy >>();
50- String [] fmsPossibilities = {"LL" , "LR" , "RL" , "RR" };
56+ String [] fmsPossibilities = { "LL" , "LR" , "RL" , "RR" };
5157
5258 public static double getConst (String key , double def ) {
5359 if (!SmartDashboard .containsKey ("Const/" + key )) {
@@ -64,8 +70,8 @@ public static boolean getBool(String key, boolean def) {
6470 }
6571
6672 /**
67- * This function is run when the robot is first started up and should be used
68- * for any initialization code.
73+ * This function is run when the robot is first started up and should be
74+ * used for any initialization code.
6975 */
7076 @ Override
7177 public void robotInit () {
@@ -76,13 +82,13 @@ public void robotInit() {
7682 lift = new Lift ();
7783 dt = new Drivetrain ();
7884 oi = new OI ();
79-
85+
8086 // auto position chooser
8187 for (Position p : Position .values ()) {
8288 posChooser .addObject (p .getSDName (), p );
8389 }
8490 SmartDashboard .putData ("Starting Position" , posChooser );
85-
91+
8692 // auto strategy choosers
8793 for (String input : fmsPossibilities ) {
8894 SendableChooser <Strategy > chooser = new SendableChooser <Strategy >();
@@ -92,20 +98,21 @@ public void robotInit() {
9298 SmartDashboard .putData (input , chooser );
9399 stratChoosers .put (input , chooser );
94100 }
95-
101+
96102 // auto delay chooser
97103 SmartDashboard .putNumber ("Auto Delay" , 0 );
98-
99- // parse scripts from Preferences, which maintains values throughout reboots
104+
105+ // parse scripts from Preferences, which maintains values throughout
106+ // reboots
100107 autoScripts = AutoUtils .parseScriptFile (Preferences .getInstance ().getString ("autoscripts" , "" ));
101108
102109 listen = new Listener ();
103110 }
104111
105112 /**
106- * This function is called once each time the robot enters Disabled mode. You
107- * can use it to reset any subsystem information you want to clear when the
108- * robot is disabled.
113+ * This function is called once each time the robot enters Disabled mode.
114+ * You can use it to reset any subsystem information you want to clear when
115+ * the robot is disabled.
109116 */
110117 @ Override
111118 public void disabledInit () {
@@ -118,7 +125,7 @@ public void disabledPeriodic() {
118125 }
119126
120127 /**
121- * This function is called once during the start of autonomous in order to
128+ * This function is called once during the start of autonomous in order to
122129 * grab values from SmartDashboard and the FMS and call the Autonomous
123130 * command with those values.
124131 */
@@ -127,14 +134,14 @@ public void autonomousInit() {
127134 String fmsInput = DriverStation .getInstance ().getGameSpecificMessage ();
128135 Position startPos = posChooser .getSelected ();
129136 double autoDelay = SmartDashboard .getNumber ("Auto Delay" , 0 );
130-
137+
131138 Map <String , Strategy > strategies = new HashMap <String , Strategy >();
132139 for (Map .Entry <String , SendableChooser <Strategy >> entry : stratChoosers .entrySet ()) {
133- String key = entry .getKey ();
134- SendableChooser <Strategy > chooser = entry .getValue ();
135- strategies .put (key , chooser .getSelected ());
140+ String key = entry .getKey ();
141+ SendableChooser <Strategy > chooser = entry .getValue ();
142+ strategies .put (key , chooser .getSelected ());
136143 }
137-
144+
138145 Autonomous auto = new Autonomous (startPos , strategies , autoDelay , fmsInput , false );
139146 auto .start ();
140147 }
0 commit comments