X-Git-Url: http://challenge-bot.com/repos/?a=blobdiff_plain;f=src%2Forg%2Fusfirst%2Ffrc%2Fteam3501%2Frobot%2FRobot.java;h=3778ad0e30dbc7d9ff561a2f502ed927610234ca;hb=d1930cd9ed9720c44bc9471b7741f4218f5da842;hp=5f4715cb6ac2e9b1fcb8a7e1bef891cc95163eae;hpb=f0a71840f17c1039ce4be1f66cf324cc979a9966;p=3501%2F2017steamworks diff --git a/src/org/usfirst/frc/team3501/robot/Robot.java b/src/org/usfirst/frc/team3501/robot/Robot.java index 5f4715c..3778ad0 100644 --- a/src/org/usfirst/frc/team3501/robot/Robot.java +++ b/src/org/usfirst/frc/team3501/robot/Robot.java @@ -4,14 +4,19 @@ 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() { @@ -19,9 +24,16 @@ 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); + + driveTrain.setCANTalonsBrakeMode(driveTrain.DRIVE_COAST_MODE); } public static DriveTrain getDriveTrain() { + return DriveTrain.getDriveTrain(); } @@ -37,23 +49,64 @@ public class Robot extends IterativeRobot { return Intake.getIntake(); } + public static void swapCameraFeed() { + if (Intake.getIntake().getIntakeCameraFeed() == 1) { + UsbCamera climberCam = server.startAutomaticCapture("climbercam", 1); + UsbCamera intakeCam = server.startAutomaticCapture("intakecam", 0); + Intake.getIntake().setIntakeCameraFeed(0); + } else { + UsbCamera climberCam = server.startAutomaticCapture("climbercam", 0); + UsbCamera intakeCam = server.startAutomaticCapture("intakecam", 1); + Intake.getIntake().setIntakeCameraFeed(1); + } + + } + + // 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() { + driveTrain.setHighGear(); + driveTrain.setCANTalonsBrakeMode(driveTrain.DRIVE_COAST_MODE); } @Override public void autonomousPeriodic() { Scheduler.getInstance().run(); - } @Override public void teleopInit() { + driveTrain.setCANTalonsBrakeMode(driveTrain.DRIVE_COAST_MODE); } @Override public void teleopPeriodic() { + // driveTrain.printEncoderOutput(); Scheduler.getInstance().run(); + updateSmartDashboard(); + } + + @Override + public void disabledInit() { + driveTrain.setCANTalonsBrakeMode(driveTrain.DRIVE_BRAKE_MODE); + } + // + // @Override + // public void disabledPeriodic() { + // Scheduler.getInstance().add(new RunFlyWheel(2)); + // } + public void updateSmartDashboard() { + SmartDashboard.putNumber("left encode ", + driveTrain.getLeftEncoderDistance()); + SmartDashboard.putNumber("right encoder", + driveTrain.getRightEncoderDistance()); + SmartDashboard.putNumber("angle", driveTrain.getAngle()); + SmartDashboard.putNumber("voltage", + DriverStation.getInstance().getBatteryVoltage()); + SmartDashboard.putNumber("rpm", shooter.getShooterRPM()); + SmartDashboard.putNumber("target shooting", + shooter.getTargetShootingSpeed()); } }