mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
Catch exception when instantiating USB camera if camera isn't present
Change-Id: I7f81c26619e55b49a0d205bdefe5fcd8adc7c3e2
This commit is contained in:
@@ -164,9 +164,14 @@ public class CameraServer {
|
||||
* The name of the camera interface (e.g. "cam1")
|
||||
*/
|
||||
public void startAutomaticCapture(String cameraName) {
|
||||
USBCamera camera = new USBCamera(cameraName);
|
||||
camera.openCamera();
|
||||
startAutomaticCapture(camera);
|
||||
try {
|
||||
USBCamera camera = new USBCamera(cameraName);
|
||||
camera.openCamera();
|
||||
startAutomaticCapture(camera);
|
||||
}
|
||||
catch (VisionException ex) {
|
||||
DriverStation.reportError("Error when starting the camera: " + cameraName + " " + ex.getMessage(), true);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void startAutomaticCapture(USBCamera camera) {
|
||||
|
||||
Reference in New Issue
Block a user