mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-26 01:51:40 +00:00
Add ignored cameras regex to command-line arguemnts (#849)
This adds a regex that ignores cameras if they match it, for if you have another piece of software running that needs a second camera, or if you have a webcam in your laptop that cscore hates.
This commit is contained in:
@@ -128,12 +128,16 @@ public class HardwareConfig {
|
||||
this.blacklistedResIndices = blacklistedResIndices;
|
||||
}
|
||||
|
||||
/** @return True if the FOV has been preset to a sane value, false otherwise */
|
||||
/**
|
||||
* @return True if the FOV has been preset to a sane value, false otherwise
|
||||
*/
|
||||
public final boolean hasPresetFOV() {
|
||||
return vendorFOV > 0;
|
||||
}
|
||||
|
||||
/** @return True if any command has been configured to a non-default empty, false otherwise */
|
||||
/**
|
||||
* @return True if any command has been configured to a non-default empty, false otherwise
|
||||
*/
|
||||
public final boolean hasCommandsConfigured() {
|
||||
return cpuTempCommand != ""
|
||||
|| cpuMemoryCommand != ""
|
||||
|
||||
@@ -33,6 +33,7 @@ public class FindCirclesPipe
|
||||
// Output vector of found circles. Each vector is encoded as 3 or 4 element floating-point vector
|
||||
// (x,y,radius) or (x,y,radius,votes) .
|
||||
private final Mat circles = new Mat();
|
||||
|
||||
/**
|
||||
* Runs the process for the pipe. The reason we need a separate pipe for circles is because if we
|
||||
* were to use the FindShapes pipe, we would have to assume that any shape more than 10-20+ sides
|
||||
|
||||
@@ -82,6 +82,7 @@ public class FindPolygonPipe
|
||||
|
||||
public static class FindPolygonPipeParams {
|
||||
private final double accuracyPercentage;
|
||||
|
||||
// Should be a value between 0-100
|
||||
public FindPolygonPipeParams(double accuracyPercentage) {
|
||||
this.accuracyPercentage = accuracyPercentage;
|
||||
|
||||
@@ -44,6 +44,7 @@ public class VisionSourceManager {
|
||||
final List<UsbCameraInfo> knownUsbCameras = new CopyOnWriteArrayList<>();
|
||||
final List<CameraConfiguration> unmatchedLoadedConfigs = new CopyOnWriteArrayList<>();
|
||||
private boolean hasWarned;
|
||||
private String ignoredCamerasRegex = "";
|
||||
|
||||
private static class SingletonHolder {
|
||||
private static final VisionSourceManager INSTANCE = new VisionSourceManager();
|
||||
@@ -282,12 +283,18 @@ public class VisionSourceManager {
|
||||
return cfg;
|
||||
}
|
||||
|
||||
public void setIgnoredCamerasRegex(String ignoredCamerasRegex) {
|
||||
this.ignoredCamerasRegex = ignoredCamerasRegex;
|
||||
}
|
||||
|
||||
private List<UsbCameraInfo> filterAllowedDevices(List<UsbCameraInfo> allDevices) {
|
||||
List<UsbCameraInfo> filteredDevices = new ArrayList<>();
|
||||
for (var device : allDevices) {
|
||||
if (deviceBlacklist.contains(device.name)) {
|
||||
logger.trace(
|
||||
"Skipping blacklisted device: \"" + device.name + "\" at \"" + device.path + "\"");
|
||||
} else if (device.name.matches(ignoredCamerasRegex)) {
|
||||
logger.trace("Skipping ignored device: \"" + device.name + "\" at \"" + device.path);
|
||||
} else {
|
||||
filteredDevices.add(device);
|
||||
logger.trace(
|
||||
|
||||
@@ -49,6 +49,7 @@ public abstract class VisionSourceSettables {
|
||||
public abstract void setBrightness(int brightness);
|
||||
|
||||
public abstract void setGain(int gain);
|
||||
|
||||
// Pretty uncommon so instead of abstract this is just a no-op by default
|
||||
// Overriden by cameras with AWB gain support
|
||||
public void setRedGain(int red) {}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
package org.photonvision.common;
|
||||
|
||||
/*
|
||||
* Copyright (C) 2020 Photon Vision.
|
||||
*
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
package org.photonvision.vision.frame.provider;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
// import org.photonvision.raspi.LibCameraJNI;
|
||||
|
||||
public class LibcameraTest {
|
||||
|
||||
Reference in New Issue
Block a user