99import org .usfirst .frc .team199 .Robot2018 .commands .Autonomous ;
1010import org .usfirst .frc .team199 .Robot2018 .commands .Autonomous .Position ;
1111import org .usfirst .frc .team199 .Robot2018 .commands .Autonomous .Strategy ;
12+ import org .usfirst .frc .team199 .Robot2018 .commands .ShiftLowGear ;
1213import org .usfirst .frc .team199 .Robot2018 .subsystems .Climber ;
1314import org .usfirst .frc .team199 .Robot2018 .subsystems .ClimberAssist ;
1415import org .usfirst .frc .team199 .Robot2018 .subsystems .Drivetrain ;
@@ -41,13 +42,13 @@ public class Robot extends TimedRobot {
4142 public static Listener listen ;
4243
4344 public static OI oi ;
44-
45+
4546 public static Map <String , ArrayList <String []>> autoScripts ;
4647
4748 Command autonomousCommand ;
4849 SendableChooser <Position > posChooser = new SendableChooser <Position >();
4950 Map <String , SendableChooser <Strategy >> stratChoosers = new HashMap <String , SendableChooser <Strategy >>();
50- String [] fmsPossibilities = {"LL" , "LR" , "RL" , "RR" };
51+ String [] fmsPossibilities = { "LL" , "LR" , "RL" , "RR" };
5152
5253 public static double getConst (String key , double def ) {
5354 if (!SmartDashboard .containsKey ("Const/" + key )) {
@@ -76,13 +77,13 @@ public void robotInit() {
7677 lift = new Lift ();
7778 dt = new Drivetrain ();
7879 oi = new OI ();
79-
80+
8081 // auto position chooser
8182 for (Position p : Position .values ()) {
8283 posChooser .addObject (p .getSDName (), p );
8384 }
8485 SmartDashboard .putData ("Starting Position" , posChooser );
85-
86+
8687 // auto strategy choosers
8788 for (String input : fmsPossibilities ) {
8889 SendableChooser <Strategy > chooser = new SendableChooser <Strategy >();
@@ -92,10 +93,10 @@ public void robotInit() {
9293 SmartDashboard .putData (input , chooser );
9394 stratChoosers .put (input , chooser );
9495 }
95-
96+
9697 // auto delay chooser
9798 SmartDashboard .putNumber ("Auto Delay" , 0 );
98-
99+
99100 // parse scripts from Preferences, which maintains values throughout reboots
100101 autoScripts = AutoUtils .parseScriptFile (Preferences .getInstance ().getString ("autoscripts" , "" ));
101102
@@ -118,23 +119,24 @@ public void disabledPeriodic() {
118119 }
119120
120121 /**
121- * This function is called once during the start of autonomous in order to
122- * grab values from SmartDashboard and the FMS and call the Autonomous
123- * command with those values.
122+ * This function is called once during the start of autonomous in order to grab
123+ * values from SmartDashboard and the FMS and call the Autonomous command with
124+ * those values.
124125 */
125126 @ Override
126127 public void autonomousInit () {
128+ Scheduler .getInstance ().add (new ShiftLowGear ());
127129 String fmsInput = DriverStation .getInstance ().getGameSpecificMessage ();
128130 Position startPos = posChooser .getSelected ();
129131 double autoDelay = SmartDashboard .getNumber ("Auto Delay" , 0 );
130-
132+
131133 Map <String , Strategy > strategies = new HashMap <String , Strategy >();
132134 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 ());
135+ String key = entry .getKey ();
136+ SendableChooser <Strategy > chooser = entry .getValue ();
137+ strategies .put (key , chooser .getSelected ());
136138 }
137-
139+
138140 Autonomous auto = new Autonomous (startPos , strategies , autoDelay , fmsInput , false );
139141 auto .start ();
140142 }
0 commit comments