Add ToggleIndexerPiston class
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / Robot.java
index db5e469ff3be6a031e0efbfc571c6a9a13727cfd..455de4e62ec598d5270faa5e97c4a2746d15b380 100644 (file)
@@ -1,18 +1,22 @@
 package org.usfirst.frc.team3501.robot;
 
-import org.usfirst.frc.team3501.robot.commands.driving.DriveDistance;
 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();
   }
 
@@ -38,31 +46,39 @@ public class Robot extends IterativeRobot {
     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 DriveDistance(25, 10));
-    if (driveTrain.getLeftGearPistonValue() != driveTrain
-        .getRightGearPistonValue()) {
-      driveTrain.setHighGear();
-    }
+    driveTrain.setHighGear(driveTrain.getRightPiston());
+    driveTrain.setHighGear(driveTrain.getLeftPiston());
   }
 
   @Override
   public void autonomousPeriodic() {
     Scheduler.getInstance().run();
-
   }
 
   @Override
   public void teleopInit() {
-
   }
 
   @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());
   }
 }