Package limelight

Class Limelight

java.lang.Object
limelight.Limelight

public class Limelight extends Object
Limelight Camera class.
  • Field Details

  • Constructor Details

    • Limelight

      public Limelight(String name)
      Constructs and configures the Limelight NT Values.
      Parameters:
      name - Name of the limelight
  • Method Details

    • isAvailable

      public static boolean isAvailable(String limelightName)
      Verify limelight name exists as a table in NT.

      This check is expected to be run once during robot construction and is not intended to be checked in the iterative loop.

      Use check "yourLimelightObject.getData().targetData.getTargetStatus())"" for the validity of an iteration for 2d targeting.

      For valid 3d pose check "yourLimelightPoseEstimatorObject.getPoseEstimate().get().hasData"

      Parameters:
      limelightName - Limelight Name to check for table existence.
      Returns:
      true if an NT table exists with requested LL name.

      false and issues a WPILib Error Alert if requested LL doesn't appear as an NT table.

    • getPoseEstimator

      public LimelightPoseEstimator getPoseEstimator(boolean megatag2)
      Parameters:
      megatag2 - Use MegaTag2.
      Returns:
      LimelightPoseEstimator
    • getSettings

      public LimelightSettings getSettings()
      Get the LimelightSettings preparatory to changing settings.

      While this method does get current settings from the LL there are no getters provided for the settings so they are useless, dead data. This merely provides a stub for the various ".withXXXX" settings to attach to.

      This method may be used as often as needed and may contain none or more chained ".withXXXX" settings.

      Returns:
      object used as the target of the various ".withXXXX" settings methods.
    • getData

      public LimelightData getData()
      Get the LimelightData object for the Limelight
      Returns:
      LimelightData object.
    • snapshot

      public void snapshot(String snapshotname)
      Asynchronously take a snapshot in limelight.
      Parameters:
      snapshotname - Snapshot name to save.
    • getLatestResults

      public Optional<LimelightResults> getLatestResults()
      Gets the latest JSON LimelightResults output and returns a LimelightResults object.
      Returns:
      LimelightResults object containing all current target data
    • flush

      public void flush()
      Flush the NetworkTable data to server.
    • getNTTable

      public NetworkTable getNTTable()
      Get the NetworkTable for this limelight.
      Returns:
      NetworkTable for this limelight.