Remove pointless code and add print commands.
[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("AxisCamera", "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.println("Switching to climber camera.");
51 } else if (curCam.equals(climberCam)) {
52 changeCam(intakeCam);
53 curCam = intakeCam;
54 System.out.println("Switching to intake camera.");
55 }
56 }
57
58 /**
59 *
60 * Change the camera to get image from to a different one
61 *
62 * newId for camera
63 */
64 public void changeCam(VideoSource cam) {
65 System.out.println("Changing cameras...");
66 server.getVideo(cam);
67 }
68 }