1 package org
.usfirst
.frc
.team3501
.robot
;
3 import com
.ni
.vision
.NIVision
.Image
;
5 import edu
.wpi
.cscore
.AxisCamera
;
6 import edu
.wpi
.cscore
.UsbCamera
;
7 import edu
.wpi
.cscore
.VideoSource
;
8 import edu
.wpi
.first
.wpilibj
.CameraServer
;
10 public class CameraFeeds
{
11 // private final int intakeCam;
12 // private final int climberCam;
14 private VideoSource curCam
;
15 private CameraServer server
;
16 private static UsbCamera intakeCam
;
17 private static AxisCamera climberCam
;
18 private static String usbCamName
;
19 private static String axisCamName
;
21 @SuppressWarnings("deprecation")
22 public CameraFeeds(/* Joystick Button */) {
23 // Get camera ids by supplying camera name ex 'cam0', found on roborio web
27 * NIVision.IMAQdxOpenCamera(Constants.CameraFeeds.camNameCenter,
28 * NIVision.IMAQdxCameraControlMode.CameraControlModeController); climberCam
29 * = NIVision.IMAQdxOpenCamera(Constants.CameraFeeds.camNameRight,
30 * NIVision.IMAQdxCameraControlMode.CameraControlModeController); curCam =
31 * intakeCam; // Img that will contain camera img frame =
32 * NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_RGB, 0); // Server that
33 * we'll give the img to server = CameraServer.getInstance();
34 * server.setSize(Constants.CameraFeeds.imgQuality);
37 server
= CameraServer
.getInstance();
38 climberCam
= server
.addAxisCamera("axisCamera", "10.35.1.11");
39 intakeCam
= server
.startAutomaticCapture();
41 usbCamName
= intakeCam
.getName();
42 axisCamName
= climberCam
.getName();
44 // server = CameraServer.getInstance();
45 // axisCamera = cameraServer2.addAxisCamera("axisCamera", "10.35.1.11");
46 // cameraFeeds = new CameraFeeds();
53 public void toggleCamera() {
54 if (curCam
.equals(intakeCam
)) {
55 changeCam(climberCam
);
59 if (curCam
.equals(climberCam
)) {
67 * Change the camera to get imgs from to a different one
72 public void changeCam(VideoSource cam
) {
73 server
.removeCamera(axisCamName
);
74 server
.removeCamera(usbCamName
);
75 server
.addCamera(cam
);