camera test

This commit is contained in:
aarav18
2022-03-25 09:15:02 -06:00
parent a4f7282ecc
commit 5f326a4958
2 changed files with 13 additions and 5 deletions
@@ -8,6 +8,7 @@
package frc4388.robot.subsystems;
import edu.wpi.first.cscore.*;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.cameraserver.CameraServer;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
@@ -21,14 +22,20 @@ public class Camera extends SubsystemBase {
* @param height Resolution height.
* @param brightness Percent brightness of the stream.
*/
public UsbCamera test;
public Camera(String name, int id, int width, int height, int brightness) {
try{
UsbCamera cam = new UsbCamera(name, id);
UsbCamera cam = CameraServer.startAutomaticCapture();//new UsbCamera(name, id);
cam.setResolution(width, height);
cam.setBrightness(brightness);
cam.setFPS(10);
VideoSource camera = cam;
CameraServer.startAutomaticCapture(camera);
SmartDashboard.putBoolean("cam enabled", cam.isEnabled());
SmartDashboard.putBoolean("cam connected", cam.isConnected());
// VideoSource camera = cam;
// CameraServer.addCamera(camera);
// CameraServer.startAutomaticCapture(camera);
}
catch(Exception e) {
System.err.println("Camera broken, pls nerf");