oops tab -> spaces
[3501/3501-spark-go] / src / org / usfirst / frc / team3501 / robot / Robot.java
index 67f54e14fcdf1ef00265ff0b25306c193670308e..c9c43d42f118444400680bb701d1cc9ceea5fdf0 100644 (file)
@@ -11,41 +11,47 @@ import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
 import org.usfirst.frc.team3501.robot.autons.*;
 import org.usfirst.frc.team3501.robot.commands.*;
 import org.usfirst.frc.team3501.robot.subsystems.*;
+import org.usfirst.frc.team3501.util.AutonData;
 
 public class Robot extends IterativeRobot {
 
-       public static Drivetrain drivetrain;
-       public static Arm arm;
-       public static Claw claw;
+    public static Drivetrain drivetrain;
+    public static Arm arm;
+    public static Claw claw;
 
-       public static Pneumatics pneumatics;
+    public static Pneumatics pneumatics;
 
-       public static OI oi;
+    public static OI oi;
 
-       private SendableChooser autoChooser;
+    public static AutonData autonData;
 
+    private SendableChooser autonChooser;
     private Command autonomousCommand;
 
     public void robotInit() {
-               oi = new OI();
+        drivetrain = new Drivetrain();
+        arm        = new Arm();
+        claw       = new Claw();
 
-               drivetrain = new Drivetrain();
-               arm        = new Arm();
-               claw       = new Claw();
+        pneumatics = new Pneumatics();
 
-               pneumatics = new Pneumatics();
+        autonData = new AutonData();
 
-               chooseAuto();
+        oi = new OI();
+
+        chooseAuto();
     }
 
-       public void disabledPeriodic() {
-               Scheduler.getInstance().run();
-       }
+    public void disabledPeriodic() {
+        Scheduler.getInstance().run();
+    }
 
     public void autonomousInit() {
         schedule(new TurnOnCompressor());
 
-        autonomousCommand = (Command) autoChooser.getSelected();
+        autonData.update();
+
+        autonomousCommand = (Command) autonChooser.getSelected();
         autonomousCommand.start();
     }
 
@@ -56,7 +62,8 @@ public class Robot extends IterativeRobot {
     public void teleopInit() {
         schedule(new TurnOnCompressor());
 
-        autonomousCommand.cancel();
+        if (autonomousCommand != null)
+            autonomousCommand.cancel();
     }
 
     public void teleopPeriodic() {
@@ -67,18 +74,14 @@ public class Robot extends IterativeRobot {
         LiveWindow.run();
     }
 
-    public void disabledInit() {
-        schedule(new TurnOffCompressor());
-    }
-
     private void chooseAuto() {
-        autoChooser = new SendableChooser();
+        autonChooser = new SendableChooser();
 
-        autoChooser.addDefault("Pick up container", new ContainerOverStep());
-        autoChooser.addObject("Drive over step",    new DriveOverStep());
-        autoChooser.addObject("Drive past step",    new DrivePastStep());
+        autonChooser.addDefault("Pick up container", new ContainerOverStep());
+        autonChooser.addObject("Drive over step",    new DriveOverStep());
+        autonChooser.addObject("Drive past step",    new DrivePastStep());
 
-        SmartDashboard.putData("Auto Mode", autoChooser);
+        SmartDashboard.putData("Auto Mode", autonChooser);
     }
 
     private void schedule(Command c) {