Add ToggleIndexerPiston class
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / Robot.java
index 5b0f35e01656a4fd26370230fbd4e7eeb7a8eaec..455de4e62ec598d5270faa5e97c4a2746d15b380 100644 (file)
@@ -1,18 +1,22 @@
 package org.usfirst.frc.team3501.robot;
 
-import org.usfirst.frc.team3501.robot.commands.driving.TimeDrive;
 import org.usfirst.frc.team3501.robot.subsystems.DriveTrain;
 import org.usfirst.frc.team3501.robot.subsystems.Intake;
 import org.usfirst.frc.team3501.robot.subsystems.Shooter;
 
+import edu.wpi.cscore.UsbCamera;
+import edu.wpi.first.wpilibj.CameraServer;
+import edu.wpi.first.wpilibj.DriverStation;
 import edu.wpi.first.wpilibj.IterativeRobot;
 import edu.wpi.first.wpilibj.command.Scheduler;
+import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
 
 public class Robot extends IterativeRobot {
   private static DriveTrain driveTrain;
   private static Shooter shooter;
   private static OI oi;
   private static Intake intake;
+  private static CameraServer server;
 
   @Override
   public void robotInit() {
@@ -20,9 +24,13 @@ public class Robot extends IterativeRobot {
     oi = OI.getOI();
     shooter = Shooter.getShooter();
     intake = Intake.getIntake();
+    server = CameraServer.getInstance();
+    UsbCamera climberCam = server.startAutomaticCapture("climbercam", 0);
+    UsbCamera intakeCam = server.startAutomaticCapture("intakecam", 1);
   }
 
   public static DriveTrain getDriveTrain() {
+
     return DriveTrain.getDriveTrain();
   }
 
@@ -35,18 +43,25 @@ public class Robot extends IterativeRobot {
   }
 
   public static Intake getIntake() {
-    return Intake.getIntake()
+    return Intake.getIntake();
+  }
+
+  public static void swapCameraFeed() {
+    UsbCamera climberCam = server.startAutomaticCapture("climbercam", 1);
+    UsbCamera intakeCam = server.startAutomaticCapture("intakecam", 0);
   }
 
+  // If the gear values do not match in the left and right piston, then they are
+  // both set to high gear
   @Override
   public void autonomousInit() {
-    Scheduler.getInstance().add(new TimeDrive(1.5, 0.4));
+    driveTrain.setHighGear(driveTrain.getRightPiston());
+    driveTrain.setHighGear(driveTrain.getLeftPiston());
   }
 
   @Override
   public void autonomousPeriodic() {
     Scheduler.getInstance().run();
-
   }
 
   @Override
@@ -56,6 +71,14 @@ public class Robot extends IterativeRobot {
   @Override
   public void teleopPeriodic() {
     Scheduler.getInstance().run();
+    updateSmartDashboard();
+  }
 
+  public void updateSmartDashboard() {
+    SmartDashboard.putNumber("angle", driveTrain.getAngle());
+    SmartDashboard.putNumber("voltage",
+        DriverStation.getInstance().getBatteryVoltage());
+    SmartDashboard.putNumber("rpm", shooter.getShooterRPM());
+    SmartDashboard.putNumber("motor value", shooter.getCurrentShootingSpeed());
   }
 }