1 package org
.usfirst
.frc
.team3501
.robot
;
3 import com
.ni
.vision
.NIVision
;
4 import com
.ni
.vision
.NIVision
.Image
;
6 import edu
.wpi
.cscore
.AxisCamera
;
7 import edu
.wpi
.cscore
.UsbCamera
;
8 import edu
.wpi
.first
.wpilibj
.CameraServer
;
10 public class CameraFeeds
{
11 // private final int intakeCam;
12 // private final int climberCam;
15 private CameraServer server
;
16 private static UsbCamera intakeCam
;
17 private static AxisCamera climberCam
;
19 @SuppressWarnings("deprecation")
20 public CameraFeeds(/* Joystick Button */) {
21 // Get camera ids by supplying camera name ex 'cam0', found on roborio web
25 * NIVision.IMAQdxOpenCamera(Constants.CameraFeeds.camNameCenter,
26 * NIVision.IMAQdxCameraControlMode.CameraControlModeController); climberCam
27 * = NIVision.IMAQdxOpenCamera(Constants.CameraFeeds.camNameRight,
28 * NIVision.IMAQdxCameraControlMode.CameraControlModeController); curCam =
29 * intakeCam; // Img that will contain camera img frame =
30 * NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_RGB, 0); // Server that
31 * we'll give the img to server = CameraServer.getInstance();
32 * server.setSize(Constants.CameraFeeds.imgQuality);
34 intakeCam
= CameraServer
.getInstance().startAutomaticCapture();
35 CameraServer
.getInstance().startAutomaticCapture();
36 server
= CameraServer
.getInstance();
37 climberCam
= server
.addAxisCamera("axisCamera", "10.35.1.11");
39 // server = CameraServer.getInstance();
40 // axisCamera = cameraServer2.addAxisCamera("axisCamera", "10.35.1.11");
41 // cameraFeeds = new CameraFeeds();
50 if(/*add test for toggle*/)
53 if(/*add test for toggle*/)
54 changeCam(climberCam
);
60 * Stop aka close camera stream
63 NIVision
.IMAQdxStopAcquisition(curCam
);
68 * Change the camera to get imgs from to a different one
73 public void changeCam(/* int newId */) {
74 // NIVision.IMAQdxStopAcquisition(curCam);
75 // NIVision.IMAQdxConfigureGrab(newId);
76 // NIVision.IMAQdxStartAcquisition(newId);
81 * Get the img from current camera and give it to the server
83 public void updateCam() {
84 NIVision
.IMAQdxGrab(curCam
, frame
, 1);
85 server
.setImage(frame
);