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
;
14 private CameraServer server
;
15 // private static UsbCamera intakeCam;
16 // private static AxisCamera climberCam;
18 @SuppressWarnings("deprecation")
19 public CameraFeeds() {
20 // Get camera ids by supplying camera name ex 'cam0', found on roborio web
22 intakeCam
= NIVision
.IMAQdxOpenCamera(Constants
.CameraFeeds
.camNameCenter
,
23 NIVision
.IMAQdxCameraControlMode
.CameraControlModeController
);
24 climberCam
= NIVision
.IMAQdxOpenCamera(Constants
.CameraFeeds
.camNameRight
,
25 NIVision
.IMAQdxCameraControlMode
.CameraControlModeController
);
27 // Img that will contain camera img
28 frame
= NIVision
.imaqCreateImage(NIVision
.ImageType
.IMAGE_RGB
, 0);
29 // Server that we'll give the img to
30 server
= CameraServer
.getInstance();
31 server
.setSize(Constants
.CameraFeeds
.imgQuality
);
33 // server = CameraServer.getInstance();
34 // axisCamera = cameraServer2.addAxisCamera("axisCamera", "10.35.1.11");
35 // cameraFeeds = new CameraFeeds();
44 if(/*add test for toggle*/)
47 if(/*add test for toggle*/)
48 changeCam(climberCam
);
54 * Stop aka close camera stream
57 NIVision
.IMAQdxStopAcquisition(curCam
);
61 * Change the camera to get imgs from to a different one
66 public void changeCam(int newId
) {
67 NIVision
.IMAQdxStopAcquisition(curCam
);
68 NIVision
.IMAQdxConfigureGrab(newId
);
69 NIVision
.IMAQdxStartAcquisition(newId
);
74 * Get the img from current camera and give it to the server
76 public void updateCam() {
77 NIVision
.IMAQdxGrab(curCam
, frame
, 1);
78 server
.setSize(frame
);