Remove pointless code and add print commands.
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / CameraFeeds.java
index 15ea3695efe43ba65a1743d32568fb9898c5ebda..07cf52e6a4e445150b7eb2d59c6637f475dd2b3c 100755 (executable)
@@ -17,59 +17,41 @@ public class CameraFeeds {
   private static CameraFeeds cameraFeeds = null;
 
   @SuppressWarnings("deprecation")
-  public CameraFeeds(/* Joystick Button */) {
-    // Get camera id by supplying camera name example 'cam0', found on roborio
-    // web
-    // interface
-    /*
-     * intakeCam =
-     * NIVision.IMAQdxOpenCamera(Constants.CameraFeeds.camNameCenter,
-     * NIVision.IMAQdxCameraControlMode.CameraControlModeController); climberCam
-     * = NIVision.IMAQdxOpenCamera(Constants.CameraFeeds.camNameRight,
-     * NIVision.IMAQdxCameraControlMode.CameraControlModeController); curCam =
-     * intakeCam; // Image that will contain camera image frame =
-     * NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_RGB, 0); // Server that
-     * we'll give the image to server = CameraServer.getInstance();
-     * server.setSize(Constants.CameraFeeds.imgQuality);
-     */
-
+  private CameraFeeds(/* Joystick Button */) {
+    System.out.println("Enter CameraFeeds constructor");
     server = CameraServer.getInstance();
-    climberCam = server.addAxisCamera("axisCamera", "10.35.1.11");
+    climberCam = server.addAxisCamera("AxisCamera", "10.35.1.11");
     intakeCam = server.startAutomaticCapture();
-    curCam = intakeCam;
     usbCamName = intakeCam.getName();
     axisCamName = climberCam.getName();
-
-    // server = CameraServer.getInstance();
-    // axisCamera = cameraServer2.addAxisCamera("axisCamera", "10.35.1.11");
-    // cameraFeeds = new CameraFeeds();
+    curCam = climberCam;
+    changeCam(curCam);
+    System.out.println("Leaving CameraFeeds constructor");
   }
 
   public static CameraFeeds getCameraFeeds() {
+    System.out.println("Enter CameraFeeds.getCameraFeeds");
     if (cameraFeeds == null) {
       cameraFeeds = new CameraFeeds();
     }
+    System.out.println("Leaving CameraFeeds.getCameraFeeds");
     return cameraFeeds;
-
   }
 
   public void init() {
-    changeCam(climberCam);
+    System.out.println("Initializing...");
   }
 
   public void toggleCamera() {
+    System.out.println("enter toggleCamera");
     if (curCam.equals(intakeCam)) {
       changeCam(climberCam);
       curCam = climberCam;
       System.out.println("Switching to climber camera.");
-      return;
-    }
-
-    if (curCam.equals(climberCam)) {
+    } else if (curCam.equals(climberCam)) {
       changeCam(intakeCam);
       curCam = intakeCam;
       System.out.println("Switching to intake camera.");
-      return;
     }
   }
 
@@ -80,8 +62,7 @@ public class CameraFeeds {
    * newId for camera
    */
   public void changeCam(VideoSource cam) {
-    server.removeCamera(axisCamName);
-    server.removeCamera(usbCamName);
-    server.addCamera(cam);
+    System.out.println("Changing cameras...");
+    server.getVideo(cam);
   }
 }