mirror of
https://github.com/Team4388/2022NoWayHome.git
synced 2026-06-09 08:48:07 -06:00
camera test
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user