Class PhotonVisionFrames

java.lang.Object
yall.cameras.PhotonVisionFrames

public final class PhotonVisionFrames extends Object
Turns PhotonVision results into YALL frames. PhotonVisionWrapper uses it on real robots, and VisionCamera uses it for every simulated camera.
  • Method Details

    • read

      public static List<VisionFrame> read(String cameraName, org.photonvision.PhotonCamera camera, org.photonvision.PhotonPoseEstimator poseEstimator, PoseEstimationMode mode)
      Reads a PhotonVision camera's unread results and turns them into frames.
      Parameters:
      cameraName - Name to give the frames.
      camera - The PhotonVision camera.
      poseEstimator - PhotonVision's pose estimator for the camera.
      mode - How to estimate the robot pose.
      Returns:
      The frames, oldest first.
    • toVisionResult

      public static VisionResult toVisionResult(String cameraName, org.photonvision.targeting.PhotonPipelineResult result)
      Turns one PhotonVision result into a YALL result.
      Parameters:
      cameraName - Name to give the result.
      result - The PhotonVision result.
      Returns:
      The YALL result.
    • estimatePose

      public static Optional<VisionPoseEstimate> estimatePose(String cameraName, org.photonvision.targeting.PhotonPipelineResult result, org.photonvision.PhotonPoseEstimator poseEstimator, PoseEstimationMode mode)
      Estimates the robot pose from one PhotonVision result: the trig solve for PoseEstimationMode.HEADING_ASSISTED, then the coprocessor's multi-tag result, then the lowest-ambiguity tag.
      Parameters:
      cameraName - Name to give the estimate.
      result - The PhotonVision result.
      poseEstimator - PhotonVision's pose estimator for the camera.
      mode - How to estimate the robot pose.
      Returns:
      The estimate, or empty if the result has no tags.