Class Limelight

java.lang.Object
frc.spectrumLib.vision.Limelight

public class Limelight extends Object
  • Constructor Details

  • Method Details

    • getName

      public String getName()
    • isAttached

      public boolean isAttached()
    • getHorizontalOffset

      public double getHorizontalOffset()
      Returns:
      Horizontal Offset From Crosshair To Target (LL1: -27 degrees to 27 degrees / LL2: -29.8 to 29.8 degrees)
    • getVerticalOffset

      public double getVerticalOffset()
      Returns:
      Vertical Offset From Crosshair To Target in degrees (LL1: -20.5 degrees to 20.5 degrees / LL2: -24.85 to 24.85 degrees)
    • targetInView

      public boolean targetInView()
      Returns:
      Whether the LL has any valid targets (April tags or other vision targets)
    • multipleTagsInView

      public boolean multipleTagsInView()
      Returns:
      whether the LL sees multiple tags or not
    • getTagCountInView

      public double getTagCountInView()
    • getClosestTagID

      public double getClosestTagID()
      Returns:
      the tag ID of the apriltag most centered in the LL's view (or based on different criteria set in LL dasbhoard)
    • getTargetSize

      public double getTargetSize()
    • getMegaTag1_Pose3d

      public edu.wpi.first.math.geometry.Pose3d getMegaTag1_Pose3d()
      Returns:
      the corresponding LL Pose3d (MEGATAG1) for the alliance in DriverStation.java
    • getMegaTag2_Pose2d

      public edu.wpi.first.math.geometry.Pose2d getMegaTag2_Pose2d()
      Returns:
      the corresponding LL Pose3d (MEGATAG2) for the alliance in DriverStation.java
    • getMegaTag1_PoseEstimate

      public LimelightHelpers.PoseEstimate getMegaTag1_PoseEstimate()
    • getMegaTag2_PoseEstimate

      public LimelightHelpers.PoseEstimate getMegaTag2_PoseEstimate()
    • hasAccuratePose

      public boolean hasAccuratePose()
    • getDistanceToTagFromCamera

      public double getDistanceToTagFromCamera()
      Returns:
      the distance of the 2d vector from the camera to closest apriltag
    • getRawFiducial

      public LimelightHelpers.RawFiducial[] getRawFiducial()
    • getMegaTag1PoseTimestamp

      public double getMegaTag1PoseTimestamp()
      Returns the timestamp of the MEGATAG1 pose estimation from the Limelight camera.
      Returns:
      The timestamp of the pose estimation in seconds.
    • getMegaTag2PoseTimestamp

      public double getMegaTag2PoseTimestamp()
      Returns the timestamp of the MEGATAG2 pose estimation from the Limelight camera.
      Returns:
      The timestamp of the pose estimation in seconds.
    • getPoseLatency

      @Deprecated(forRemoval=true) public double getPoseLatency()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns the latency of the pose estimation from the Limelight camera.
      Returns:
      The latency of the pose estimation in seconds.
    • getDistanceToTarget

      public double getDistanceToTarget(double targetHeight)
      get distance in meters to a target
      Parameters:
      targetHeight - meters
      Returns:
    • sendValidStatus

      public void sendValidStatus(String message)
    • sendInvalidStatus

      public void sendInvalidStatus(String message)
    • setLimelightPipeline

      public void setLimelightPipeline(int pipelineIndex)
      Parameters:
      pipelineIndex - use pipeline indexes in Vision.VisionConfig
    • setRobotOrientation

      public void setRobotOrientation(double degrees)
    • setRobotOrientation

      public void setRobotOrientation(double degrees, double angularRate)
    • setIMUmode

      public void setIMUmode(int mode)
    • getTagTx

      public double getTagTx()
    • getTagTA

      public double getTagTA()
    • getTagRotationDegrees

      public double getTagRotationDegrees()
    • setLEDMode

      public void setLEDMode(boolean enabled)
      Sets the LED mode of the LL.
      Parameters:
      enabled - true to enable the LED mode, false to disable it
    • blinkLEDs

      public void blinkLEDs()
      Set LL LED's to blink
    • isCameraConnected

      public boolean isCameraConnected()
      Checks if the camera is connected by looking for an empty botpose array from camera.
    • printDebug

      public void printDebug()
      Prints the vision, estimated, and odometry pose to SmartDashboard
    • isIntegrating

      public boolean isIntegrating()
    • setIntegrating

      public Limelight setIntegrating(boolean isIntegrating)
      Returns:
      this.
    • getCameraName

      public String getCameraName()
    • getLogStatus

      public String getLogStatus()
    • setLogStatus

      public Limelight setLogStatus(String logStatus)
      Returns:
      this.
    • getTagStatus

      public String getTagStatus()
    • setTagStatus

      public Limelight setTagStatus(String tagStatus)
      Returns:
      this.