Skip to content

Commit

Permalink
Update VisionSourceManager.java
Browse files Browse the repository at this point in the history
  • Loading branch information
BytingBulldogs3539 committed Dec 24, 2023
1 parent f07bb5f commit cadda0a
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public class VisionSourceManager {

final List<CameraConfiguration> unmatchedLoadedConfigs = new CopyOnWriteArrayList<>();
private boolean hasWarned;
private boolean hasWarnedNoCameras = false;
private String ignoredCamerasRegex = "";

private static class SingletonHolder {
Expand Down Expand Up @@ -138,16 +139,21 @@ protected List<VisionSource> tryMatchCamImpl(ArrayList<CameraInfo> cameraInfos)
connectedCameras.addAll(new ArrayList<>(filterAllowedDevices(getConnectedCSICameras())));
} else {
connectedCameras = new ArrayList<>(filterAllowedDevices(cameraInfos));
createSources = false;
createSources =
false; // Dont create sources if we are using supplied camerainfo for unit tests.
}

// Return no new sources because there are no new sources
if (connectedCameras.isEmpty() && !cameraInfos.isEmpty()) {
logger.warn(
"No cameras were detected! Check that all cameras are connected, and that the path is correct.");
if (hasWarnedNoCameras) {
logger.warn(
"No cameras were detected! Check that all cameras are connected, and that the path is correct.");
hasWarnedNoCameras = true;
}
return null;
}
} else hasWarnedNoCameras = false;

// Remove any known cameras.
connectedCameras.removeIf(c -> knownCameras.contains(c));

// All cameras are already loaded return no new sources.
Expand Down Expand Up @@ -458,6 +464,7 @@ private static List<VisionSource> loadVisionSourcesFromCamConfigs(
boolean is_pi = Platform.isRaspberryPi();

if (configuration.cameraType == CameraType.ZeroCopyPicam && is_pi) {
// If the camera was loaded from libcamera then create its source using libcamera.
var piCamSrc = new LibcameraGpuSource(configuration);
cameraSources.add(piCamSrc);
} else {
Expand Down

0 comments on commit cadda0a

Please sign in to comment.