1 package org
.usfirst
.frc
.team3501
.robot
;
3 import edu
.wpi
.cscore
.UsbCamera
;
4 import edu
.wpi
.first
.wpilibj
.CameraServer
;
6 public class CameraFeeds
{
7 // private final int intakeCam;
8 // private final int climberCam;
10 private CameraServer server
;
11 private static UsbCamera intakeCam
;
12 private static UsbCamera climberCam
;
13 private static String intakeCamName
;
14 private static String climberCamName
;
15 private static CameraFeeds cameraFeeds
= null;
17 @SuppressWarnings("deprecation")
18 private CameraFeeds(/* Joystick Button */) {
19 System
.out
.println("Enter CameraFeeds constructor");
20 server
= CameraServer
.getInstance();
21 climberCam
= server
.startAutomaticCapture();
22 intakeCam
= server
.startAutomaticCapture();
23 intakeCamName
= intakeCam
.getName();
24 climberCamName
= climberCam
.getName();
26 System
.out
.println("Leaving CameraFeeds constructor");
29 public static CameraFeeds
getCameraFeeds() {
30 System
.out
.println("Enter CameraFeeds.getCameraFeeds");
31 if (cameraFeeds
== null) {
32 cameraFeeds
= new CameraFeeds();
34 System
.out
.println("Leaving CameraFeeds.getCameraFeeds");
39 System
.out
.println("Initializing...");
42 public void toggleCamera() {
48 * Change the camera to get image from to a different one
52 public void changeCam() {
53 System
.out
.println("enter toggleCamera");
54 if (curCam
== "intakeCam") {
55 server
.getVideo(climberCamName
);
56 curCam
= "climberCam";
57 System
.out
.println("Switching to climber camera, curCam = " + curCam
);
58 } else if (curCam
== "climberCam") {
59 server
.getVideo(intakeCamName
);
61 System
.out
.println("Switching to intake camera, curCam = " + curCam
);