Class VisionSourceManager

java.lang.Object
org.photonvision.vision.processes.VisionSourceManager

public class VisionSourceManager extends Object
This class manages starting up VisionModules for serialized devices (loadVisionSourceFromCamConfig(org.photonvision.common.configuration.CameraConfiguration)), as well as handling requests from users to disable (release the camera device, but keep the configuration around) (deactivateVisionSource(java.lang.String)), reactivate (recreate a VisionModule from a saved and currently disabled configuration) (reactivateDisabledCameraConfig(java.lang.String)), and create a new VisionModule from a PVCameraInfo (assignUnmatchedCamera(org.photonvision.vision.camera.PVCameraInfo)).

We now require user interaction for pretty much every operation this undertakes.

  • Field Details

  • Constructor Details

    • VisionSourceManager

      public VisionSourceManager()
  • Method Details

    • getInstance

      public static VisionSourceManager getInstance()
    • registerTimedTasks

      public void registerTimedTasks()
    • registerLoadedConfigs

      public void registerLoadedConfigs(Collection<CameraConfiguration> configs)
      Register new camera configs loaded from disk. This will create vision modules for each camera config and start them.
      Parameters:
      configs - The loaded camera configs.
    • reactivateDisabledCameraConfig

      public boolean reactivateDisabledCameraConfig(String uniqueName)
      Reactivate a previously created vision source
      Parameters:
      uniqueName -
    • assignUnmatchedCamera

      public boolean assignUnmatchedCamera(PVCameraInfo cameraInfo)
      Assign a camera that currently has no associated CameraConfiguration loaded.
      Parameters:
      cameraInfo -
    • deleteVisionSource

      public boolean deleteVisionSource(String uniqueName)
    • deactivateVisionSource

      public boolean deactivateVisionSource(String uniqueName)
    • getVsmState

    • pushUiUpdate

      protected void pushUiUpdate()
    • getConnectedCameras

      protected List<PVCameraInfo> getConnectedCameras()
    • loadVisionSourceFromCamConfig

      protected VisionSource loadVisionSourceFromCamConfig(CameraConfiguration configuration)
      Convert a configuration into a VisionSource. The VisionSource type is pulled from the CameraConfiguration's matchedCameraInfo. We depend on the underlying VisionSource to be robust to disconnected sources at boot

      Verify that nickname is unique within the set of deserialized camera configurations, adding random characters if this isn't the case

    • getVisionModules

      public List<VisionModule> getVisionModules()