Fix ChangeCameraView
authorRohan Rodrigues <rohanrodrigues19@gmail.com>
Fri, 3 Mar 2017 01:16:34 +0000 (17:16 -0800)
committerRohan Rodrigues <rohanrodrigues19@gmail.com>
Fri, 3 Mar 2017 01:16:34 +0000 (17:16 -0800)
src/org/usfirst/frc/team3501/robot/OI.java
src/org/usfirst/frc/team3501/robot/Robot.java
src/org/usfirst/frc/team3501/robot/utils/ChangeCameraView.java [new file with mode: 0644]

index 243e330f5b7b1c041cd6989140d3caf989e2656c..bf3c20f34b0d08ce94ab5970d566dc32aaaae293 100644 (file)
@@ -1,5 +1,8 @@
 package org.usfirst.frc.team3501.robot;
 
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+
 import org.usfirst.frc.team3501.robot.commands.climber.ToggleWinch;
 import org.usfirst.frc.team3501.robot.commands.driving.ToggleGear;
 import org.usfirst.frc.team3501.robot.commands.intake.ReverseIntakeContinuous;
@@ -9,12 +12,13 @@ import org.usfirst.frc.team3501.robot.commands.shooter.IncreaseShootingSpeed;
 import org.usfirst.frc.team3501.robot.commands.shooter.ReverseIndexWheelContinuous;
 import org.usfirst.frc.team3501.robot.commands.shooter.RunFlyWheelContinuous;
 import org.usfirst.frc.team3501.robot.commands.shooter.RunIndexWheelContinuous;
+import org.usfirst.frc.team3501.robot.utils.ChangeCameraView;
 
 import edu.wpi.first.wpilibj.Joystick;
 import edu.wpi.first.wpilibj.buttons.Button;
 import edu.wpi.first.wpilibj.buttons.JoystickButton;
 
-public class OI {
+public class OI implements KeyListener {
   private static OI oi;
   public static Joystick leftJoystick;
   public static Joystick rightJoystick;
@@ -83,4 +87,21 @@ public class OI {
       oi = new OI();
     return oi;
   }
+
+  @Override
+  public void keyTyped(KeyEvent e) {
+
+  }
+
+  @Override
+  public void keyPressed(KeyEvent e) {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void keyReleased(KeyEvent e) {
+    // TODO Auto-generated method stub
+
+  }
 }
index 1278a330a14aa63999100881d93978a7538cd2ff..e72f07e03b85c3a2c8512acf2989800469be42af 100644 (file)
@@ -16,6 +16,7 @@ public class Robot extends IterativeRobot {
   private static Shooter shooter;
   private static OI oi;
   private static Intake intake;
+  private static CameraServer server;
 
   @Override
   public void robotInit() {
@@ -23,7 +24,7 @@ public class Robot extends IterativeRobot {
     oi = OI.getOI();
     shooter = Shooter.getShooter();
     intake = Intake.getIntake();
-    CameraServer server = CameraServer.getInstance();
+    server = CameraServer.getInstance();
     UsbCamera climberCam = server.startAutomaticCapture("climbercam", 0);
     UsbCamera intakeCam = server.startAutomaticCapture("intakecam", 1);
   }
@@ -45,6 +46,11 @@ 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
diff --git a/src/org/usfirst/frc/team3501/robot/utils/ChangeCameraView.java b/src/org/usfirst/frc/team3501/robot/utils/ChangeCameraView.java
new file mode 100644 (file)
index 0000000..9615c4e
--- /dev/null
@@ -0,0 +1,36 @@
+package org.usfirst.frc.team3501.robot.utils;
+
+import org.usfirst.frc.team3501.robot.Robot;
+
+import edu.wpi.first.wpilibj.command.Command;
+
+/**
+ *
+ */
+public class ChangeCameraView extends Command {
+
+  public ChangeCameraView() {
+  }
+
+  @Override
+  protected void initialize() {
+  }
+
+  @Override
+  protected void execute() {
+    Robot.swapCameraFeed();
+  }
+
+  @Override
+  protected boolean isFinished() {
+    return true;
+  }
+
+  @Override
+  protected void end() {
+  }
+
+  @Override
+  protected void interrupted() {
+  }
+}