rearrange a few more files. realize that adding the auton read from file thing was...
[3501/3501-spark-go] / src / org / usfirst / frc / team3501 / robot / Robot.java
index b5ac5b7a98a13dd563a37dfbe2e9e504cd165755..c7ef783478c8307e5b01d3e5ae714dd192e9b887 100644 (file)
@@ -9,23 +9,36 @@ import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
 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 final Drivetrain drivetrain = new Drivetrain();
-       public static final Arm               arm = new Arm();
-       public static final Claw             claw = new Claw();
+       public static Drivetrain drivetrain;
+       public static Arm arm;
+       public static Claw claw;
+
+       public static Pneumatics pneumatics;
 
        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();
+
+               pneumatics = new Pneumatics();
+
+               autonData = new AutonData();
+
                chooseAuto();
     }
 
@@ -34,7 +47,11 @@ public class Robot extends IterativeRobot {
        }
 
     public void autonomousInit() {
-        autonomousCommand = (Command) autoChooser.getSelected();
+        schedule(new TurnOnCompressor());
+
+        autonData.update();
+
+        autonomousCommand = (Command) autonChooser.getSelected();
         autonomousCommand.start();
     }
 
@@ -43,6 +60,8 @@ public class Robot extends IterativeRobot {
     }
 
     public void teleopInit() {
+        schedule(new TurnOnCompressor());
+
         autonomousCommand.cancel();
     }
 
@@ -55,11 +74,16 @@ public class Robot extends IterativeRobot {
     }
 
     private void chooseAuto() {
-        autoChooser = new SendableChooser();
+        autonChooser = new SendableChooser();
 
-        autoChooser.addDefault("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", autonChooser);
+    }
 
-        SmartDashboard.putData("Auto Mode", autoChooser);
+    private void schedule(Command c) {
+        Scheduler.getInstance().add(c);
     }
 }