f04abbeed6bad84533cf633c1dc9ad29e1963456
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();
27 System
.out
.println("Leaving CameraFeeds constructor");
30 public static CameraFeeds
getCameraFeeds() {
31 System
.out
.println("Enter CameraFeeds.getCameraFeeds");
32 if (cameraFeeds
== null) {
33 cameraFeeds
= new CameraFeeds();
35 System
.out
.println("Leaving CameraFeeds.getCameraFeeds");
40 System
.out
.println("Initializing...");
43 public void toggleCamera() {
49 * Change the camera to get image from to a different one
53 public void changeCam() {
54 System
.out
.println("enter toggleCamera");
55 if (curCam
== "intakeCam") {
56 server
.getVideo(climberCamName
);
57 curCam
= "climberCam";
58 System
.out
.println("Switching to climber camera, curCam = " + curCam
);
59 } else if (curCam
== "climberCam") {
60 server
.getVideo(intakeCamName
);
62 System
.out
.println("Switching to intake camera, curCam = " + curCam
);