From d1930cd9ed9720c44bc9471b7741f4218f5da842 Mon Sep 17 00:00:00 2001 From: Rohan Rodrigues Date: Wed, 8 Mar 2017 17:26:16 -0800 Subject: [PATCH] Fix code to swap camera feed --- src/org/usfirst/frc/team3501/robot/Robot.java | 12 ++++++++++-- .../frc/team3501/robot/subsystems/Intake.java | 10 ++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) 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. -- 2.30.2