Class PhotonVision

java.lang.Object
frc8768.visionlib.PhotonVision
All Implemented Interfaces:
Vision

public class PhotonVision extends Object implements Vision
Impl for photonvision for Vision-related things.
  • Constructor Details

    • PhotonVision

      public PhotonVision(String name)
      Parameters:
      name - Camera hostname
  • Method Details

    • getTargets

      public List<org.photonvision.targeting.PhotonTrackedTarget> getTargets()
      Get all targets.
      Specified by:
      getTargets in interface Vision
      Returns:
      All targets in view.
    • changePipeline

      public void changePipeline(int index)
      Change the current pipeline.
      Specified by:
      changePipeline in interface Vision
      Parameters:
      index - Pipeline index, depends on your configuration.
    • getDistanceToTarget

      public double getDistanceToTarget(double mountAngle, double mountHeight, double goalHeight, boolean topY)
      Get the Distance to target via trigonometry.
      Specified by:
      getDistanceToTarget in interface Vision
      Parameters:
      mountAngle - The amount of degrees back the limelight is.
      mountHeight - Height in inches from center of limelight lens to floor.
      goalHeight - Distance in inches from floor to center of target.
      topY - Get the top most location from the camera. See this method.
      Returns:
      Distance to target, returns -1 on fail.
    • getMaxPointY

      public double getMaxPointY()
      Sometimes, you may want to find the maximum Y for corners for the intake to suck in the top of a cone, or cube. This function is helpful for that.
      Specified by:
      getMaxPointY in interface Vision
      Returns:
      The maximum Y point for all corners, or -1 if none is found