1 package org
.usfirst
.frc
.team3501
.robot
;
3 import edu
.wpi
.cscore
.AxisCamera
;
4 import edu
.wpi
.cscore
.UsbCamera
;
5 import edu
.wpi
.first
.wpilibj
.CameraServer
;
7 public class CameraFeeds
{
8 // private final int intakeCam;
9 // private final int climberCam;
10 private String curCam
;
11 private CameraServer server
;
12 private static UsbCamera intakeCam
;
13 private static AxisCamera climberCam
;
14 private static String usbCamName
;
15 private static String axisCamName
;
16 private static CameraFeeds cameraFeeds
= null;
18 @SuppressWarnings("deprecation")
19 private CameraFeeds(/* Joystick Button */) {
20 System
.out
.println("Enter CameraFeeds constructor");
21 server
= CameraServer
.getInstance();
22 climberCam
= server
.addAxisCamera("ClimberCam", "10.35.1.11");
23 intakeCam
= server
.startAutomaticCapture();
24 usbCamName
= intakeCam
.getName();
25 axisCamName
= climberCam
.getName();
28 System
.out
.println("Leaving CameraFeeds constructor");
31 public static CameraFeeds
getCameraFeeds() {
32 System
.out
.println("Enter CameraFeeds.getCameraFeeds");
33 if (cameraFeeds
== null) {
34 cameraFeeds
= new CameraFeeds();
36 System
.out
.println("Leaving CameraFeeds.getCameraFeeds");
41 System
.out
.println("Initializing...");
44 public void toggleCamera() {
50 * Change the camera to get image from to a different one
54 public void changeCam() {
55 System
.out
.println("enter toggleCamera");
56 if (curCam
== "intakeCam") {
57 server
.getVideo(axisCamName
);
58 curCam
= "climberCam";
59 System
.out
.println("Switching to climber camera, curCam = " + curCam
);
60 } else if (curCam
== "climberCam") {
61 server
.getVideo(usbCamName
);
63 System
.out
.println("Switching to intake camera, curCam = " + curCam
);