Add line sets variable equal to null
authorAndres Esteban Echeverria G <estebanech@Andress-MacBook-Air.local>
Sun, 5 Feb 2017 01:07:01 +0000 (17:07 -0800)
committerRayan Hirech <ramine411@gmail.com>
Tue, 7 Feb 2017 03:46:49 +0000 (19:46 -0800)
src/org/usfirst/frc/team3501/robot/CameraFeeds.java

index 50ee60697a732766dcc6aff9ce7f37db7fa03a3d..e59b8ecc75257a1ec90282f66d6bf33b794fc0a8 100755 (executable)
@@ -1,7 +1,5 @@
 package org.usfirst.frc.team3501.robot;
 
-import com.ni.vision.NIVision.Image;
-
 import edu.wpi.cscore.AxisCamera;
 import edu.wpi.cscore.UsbCamera;
 import edu.wpi.cscore.VideoSource;
@@ -10,17 +8,18 @@ import edu.wpi.first.wpilibj.CameraServer;
 public class CameraFeeds {
   // private final int intakeCam;
   // private final int climberCam;
-  private Image frame;
   private VideoSource curCam;
   private CameraServer server;
   private static UsbCamera intakeCam;
   private static AxisCamera climberCam;
   private static String usbCamName;
   private static String axisCamName;
+  private static CameraFeeds cameraFeeds = null;
 
   @SuppressWarnings("deprecation")
   public CameraFeeds(/* Joystick Button */) {
-    // Get camera ids by supplying camera name ex 'cam0', found on roborio web
+    // Get camera id by supplying camera name example 'cam0', found on roborio web
     // interface
     /*
      * intakeCam =
@@ -28,9 +27,9 @@ public class CameraFeeds {
      * NIVision.IMAQdxCameraControlMode.CameraControlModeController); climberCam
      * = NIVision.IMAQdxOpenCamera(Constants.CameraFeeds.camNameRight,
      * NIVision.IMAQdxCameraControlMode.CameraControlModeController); curCam =
-     * intakeCam; // Img that will contain camera img frame =
+     * intakeCam; // Image that will contain camera image frame =
      * NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_RGB, 0); // Server that
-     * we'll give the img to server = CameraServer.getInstance();
+     * we'll give the image to server = CameraServer.getInstance();
      * server.setSize(Constants.CameraFeeds.imgQuality);
      */
 
@@ -45,6 +44,15 @@ public class CameraFeeds {
     // axisCamera = cameraServer2.addAxisCamera("axisCamera", "10.35.1.11");
     // cameraFeeds = new CameraFeeds();
   }
+  
+  public static CameraFeeds getCameraFeeds() {
+         if (cameraFeeds == null) {
+                 cameraFeeds = new CameraFeeds();
+         }
+         return cameraFeeds;
+         
+         
+  }
 
   public void init() {
     changeCam(intakeCam);
@@ -64,9 +72,9 @@ public class CameraFeeds {
 
   /**
    *
-   * Change the camera to get imgs from to a different one
+   * Change the camera to get image from to a different one
    *
-   * @param newId
+   * newId
    *          for camera
    */
   public void changeCam(VideoSource cam) {