From: Rohan Rodrigues Date: Thu, 9 Mar 2017 01:26:16 +0000 (-0800) Subject: Fix code to swap camera feed X-Git-Url: http://challenge-bot.com/repos/?p=3501%2F2017steamworks;a=commitdiff_plain;h=d1930cd9ed9720c44bc9471b7741f4218f5da842 Fix code to swap camera feed --- diff --git a/src/org/usfirst/frc/team3501/robot/Robot.java b/src/org/usfirst/frc/team3501/robot/Robot.java index 5e9bd3c..3778ad0 100644 --- a/src/org/usfirst/frc/team3501/robot/Robot.java +++ b/src/org/usfirst/frc/team3501/robot/Robot.java @@ -50,8 +50,16 @@ public class Robot extends IterativeRobot { } public static void swapCameraFeed() { - UsbCamera climberCam = server.startAutomaticCapture("climbercam", 1); - UsbCamera intakeCam = server.startAutomaticCapture("intakecam", 0); + 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 diff --git a/src/org/usfirst/frc/team3501/robot/subsystems/Intake.java b/src/org/usfirst/frc/team3501/robot/subsystems/Intake.java index ed47fa7..b008518 100644 --- a/src/org/usfirst/frc/team3501/robot/subsystems/Intake.java +++ b/src/org/usfirst/frc/team3501/robot/subsystems/Intake.java @@ -16,6 +16,8 @@ public class Intake extends Subsystem { public static final double INTAKE_SPEED = 1; public static final double REVERSE_SPEED = -1; + private int intakeCameraFeed = 1; + public Intake() { intakeWheel = new CANTalon(Constants.Intake.INTAKE_ROLLER_PORT); } @@ -63,6 +65,14 @@ public class Intake extends Subsystem { setSpeed(0); } + public int getIntakeCameraFeed() { + return this.intakeCameraFeed; + } + + public void setIntakeCameraFeed(int intakeCamFeed) { + this.intakeCameraFeed = intakeCamFeed; + } + /*** * Purpose is to release all balls from the ball container to the outside of * the robot. Reverses intake wheel by setting wheel speed to reverse speed.