Remove pointless code and add print commands.
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / CameraFeeds.java
CommitLineData
409d6878
ME
1package org.usfirst.frc.team3501.robot;
2
2ada01fd
RH
3import edu.wpi.cscore.AxisCamera;
4import edu.wpi.cscore.UsbCamera;
b7b608d6 5import edu.wpi.cscore.VideoSource;
409d6878
ME
6import edu.wpi.first.wpilibj.CameraServer;
7
8public class CameraFeeds {
50a075d8
RH
9 // private final int intakeCam;
10 // private final int climberCam;
4dff9cc3 11 private VideoSource curCam;
409d6878 12 private CameraServer server;
50a075d8
RH
13 private static UsbCamera intakeCam;
14 private static AxisCamera climberCam;
4dff9cc3
RH
15 private static String usbCamName;
16 private static String axisCamName;
4bc0cb18 17 private static CameraFeeds cameraFeeds = null;
409d6878 18
fbc1210e 19 @SuppressWarnings("deprecation")
9ea6a533 20 private CameraFeeds(/* Joystick Button */) {
55391ba3 21 System.out.println("Enter CameraFeeds constructor");
409d6878 22 server = CameraServer.getInstance();
55391ba3 23 climberCam = server.addAxisCamera("AxisCamera", "10.35.1.11");
4dff9cc3 24 intakeCam = server.startAutomaticCapture();
55391ba3
RH
25 usbCamName = intakeCam.getName();
26 axisCamName = climberCam.getName();
9ea6a533 27 curCam = climberCam;
55391ba3
RH
28 changeCam(curCam);
29 System.out.println("Leaving CameraFeeds constructor");
409d6878 30 }
7638f542 31
4bc0cb18 32 public static CameraFeeds getCameraFeeds() {
55391ba3 33 System.out.println("Enter CameraFeeds.getCameraFeeds");
7638f542
RH
34 if (cameraFeeds == null) {
35 cameraFeeds = new CameraFeeds();
36 }
55391ba3 37 System.out.println("Leaving CameraFeeds.getCameraFeeds");
7638f542 38 return cameraFeeds;
4bc0cb18 39 }
409d6878
ME
40
41 public void init() {
55391ba3 42 System.out.println("Initializing...");
409d6878
ME
43 }
44
4dff9cc3 45 public void toggleCamera() {
fb2aaf9c 46 System.out.println("enter toggleCamera");
4dff9cc3 47 if (curCam.equals(intakeCam)) {
fb2aaf9c 48 changeCam(climberCam);
4dff9cc3 49 curCam = climberCam;
fb2aaf9c 50 System.out.println("Switching to climber camera.");
85c0135e 51 } else if (curCam.equals(climberCam)) {
fb2aaf9c 52 changeCam(intakeCam);
4dff9cc3 53 curCam = intakeCam;
fb2aaf9c 54 System.out.println("Switching to intake camera.");
4dff9cc3 55 }
409d6878
ME
56 }
57
58 /**
50a075d8 59 *
4bc0cb18 60 * Change the camera to get image from to a different one
409d6878 61 *
7638f542 62 * newId for camera
409d6878 63 */
4dff9cc3 64 public void changeCam(VideoSource cam) {
55391ba3
RH
65 System.out.println("Changing cameras...");
66 server.getVideo(cam);
409d6878
ME
67 }
68}