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