commit
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / Robot.java
index 8616cfa765dd39fe98e3f3eeb42c6f3534c45b13..be86bc2935465efb2d34ffb38f27dd226baf8456 100644 (file)
@@ -1,14 +1,16 @@
 package org.usfirst.frc.team3501.robot;
 
-import org.usfirst.frc.team3501.robot.commands.driving.SetHighGear;
-import org.usfirst.frc.team3501.robot.commands.intakearm.MoveIntakeArm;
-import org.usfirst.frc.team3501.robot.commands.shooter.ResetCatapult;
+import org.usfirst.frc.team3501.robot.commands.driving.SetLowGear;
+import org.usfirst.frc.team3501.robot.commands.driving.TimeDrive;
 import org.usfirst.frc.team3501.robot.subsystems.DriveTrain;
 import org.usfirst.frc.team3501.robot.subsystems.IntakeArm;
 import org.usfirst.frc.team3501.robot.subsystems.Shooter;
 
+import edu.wpi.first.wpilibj.CameraServer;
 import edu.wpi.first.wpilibj.IterativeRobot;
 import edu.wpi.first.wpilibj.command.Scheduler;
+import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
+import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
 
 public class Robot extends IterativeRobot {
   public static OI oi;
@@ -16,6 +18,11 @@ public class Robot extends IterativeRobot {
   public static Shooter shooter;
   public static IntakeArm intakeArm;
 
+  SendableChooser frontChooser;
+  boolean isFront;
+
+  CameraServer cameraServer;
+
   @Override
   public void robotInit() {
     driveTrain = new DriveTrain();
@@ -23,22 +30,43 @@ public class Robot extends IterativeRobot {
     intakeArm = new IntakeArm();
 
     oi = new OI();
+    isFront = true;
+
+    frontChooser = new SendableChooser();
+    frontChooser.addDefault("Intake is front", false);
+    frontChooser.addObject("Shooter is front", true);
+
+    SmartDashboard.putData("Front chooser", frontChooser);
+
+    cameraServer = CameraServer.getInstance();
+    cameraServer.setQuality(50);
+    cameraServer.startAutomaticCapture();
+
   }
 
   @Override
   public void autonomousInit() {
+    // get options chosen from drop down menu
+
+    isFront = (boolean) frontChooser.getSelected();
+
+    if (!isFront)
+      driveTrain.toggleFlipped();
+
+    Scheduler.getInstance().add(new TimeDrive(.6, 4));
   }
 
   @Override
   public void autonomousPeriodic() {
+
     Scheduler.getInstance().run();
   }
 
   @Override
   public void teleopInit() {
-    Scheduler.getInstance().add(new SetHighGear());
-    Scheduler.getInstance().add(new ResetCatapult());
-    Scheduler.getInstance().add(new MoveIntakeArm(Constants.IntakeArm.EXTEND));
+    if (!isFront)
+      driveTrain.toggleFlipped();
+    Scheduler.getInstance().add(new SetLowGear());
   }
 
   @Override