Class Limelight

  • All Implemented Interfaces:
    edu.wpi.first.util.sendable.Sendable

    public class Limelight
    extends java.lang.Object
    implements edu.wpi.first.util.sendable.Sendable
    this class contains all of the code and functions required for using a limelight
    • Constructor Summary

      Constructors 
      Constructor Description
      Limelight()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Limelight.Position get3D()
      Results of a 3D position solution, 6 numbers: Translation (x,y,z) Rotation(pitch,yaw,roll)
      double getArea()
      Target Area
      double getCamMode()
      Gets the Limelight's Operation Mode
      Limelight.Color getColor()
      Get the average HSV color underneath the crosshair region as a NumberArray
      double getHeight()
      Vertical sidelength of the rough bounding box
      double getLEDMode()
      Get the Limelight's LED State
      double getLongestSidelength()
      Sidelength of longest side of the fitted bounding box
      double getPipe()
      True active pipeline index of the camera
      double getRaw​(java.lang.String variable)
      Get value from network table
      double getRotation()
      Skew or rotation
      double getShortestSidelength()
      Sidelength of shortest side of the fitted bounding box
      double getSnapshot()
      Get Wether Users Are Allowed Take Snapshots During A Match
      double getStream()
      Gets the Limelight's Streaming Mode
      double getWidth()
      Horizontal sidelength of the rough bounding box
      double getX()
      Horizontal Offset From Crosshair To Target
      double getY()
      Vertical Offset From Crosshair To Target
      double imageLatency()
      The image capture latency
      void initSendable​(edu.wpi.first.util.sendable.SendableBuilder builder)  
      double latency()
      The pipeline’s latency contribution
      double[] numberToDouble​(java.lang.Number[] numbers)
      Converts number array into double array
      double round​(double numberToRound)
      Rounds input to the nearest hundereths place
      void setCamMode​(double mode)
      Sets the Limelight's Operation Mode
      void setLEDMode​(double mode)
      Set the Limelight's LED State
      void setPipeline​(double pipeline)
      Sets the Limelight's Current Pipeline
      void setRaw​(java.lang.String variable, double value)
      Set value in network table
      void setSnapshot​(double mode)
      Allows Users To Take Snapshots During A Match
      void setStream​(double mode)
      Sets the Limelight's Streaming Mode
      boolean targetVisible()
      Whether the limelight has any valid targets
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Limelight

        public Limelight()
    • Method Detail

      • targetVisible

        public boolean targetVisible()
        Whether the limelight has any valid targets
        Returns:
        true or false
      • getX

        public double getX()
        Horizontal Offset From Crosshair To Target
        Returns:
        -29.8 to 29.8 degrees
      • getY

        public double getY()
        Vertical Offset From Crosshair To Target
        Returns:
        -24.85 to 24.85 degrees
      • getArea

        public double getArea()
        Target Area
        Returns:
        0% of image to 100% of image
      • getRotation

        public double getRotation()
        Skew or rotation
        Returns:
        -90 degrees to 0 degrees
      • latency

        public double latency()
        The pipeline’s latency contribution
        Returns:
        latency in miliseconds
      • imageLatency

        public double imageLatency()
        The image capture latency
        Returns:
        capture latency in miliseconds
      • getShortestSidelength

        public double getShortestSidelength()
        Sidelength of shortest side of the fitted bounding box
        Returns:
        Sidelength in pixels
      • getLongestSidelength

        public double getLongestSidelength()
        Sidelength of longest side of the fitted bounding box
        Returns:
        Sidelength in pixels
      • getWidth

        public double getWidth()
        Horizontal sidelength of the rough bounding box
        Returns:
        0 to 320 pixels
      • getHeight

        public double getHeight()
        Vertical sidelength of the rough bounding box
        Returns:
        0 to 320 pixels
      • getPipe

        public double getPipe()
        True active pipeline index of the camera
        Returns:
        pipeline 0 to 9
      • get3D

        public Limelight.Position get3D()
        Results of a 3D position solution, 6 numbers: Translation (x,y,z) Rotation(pitch,yaw,roll)
        Returns:
        Number[[x, y, z],[pitch, yaw, roll]]
      • getColor

        public Limelight.Color getColor()
        Get the average HSV color underneath the crosshair region as a NumberArray
        Returns:
        Number[hue, saturation, value]
      • getRaw

        public double getRaw​(java.lang.String variable)
        Get value from network table
        Parameters:
        variable - the value to get
        Returns:
        the value in the network table (default 0)
      • setRaw

        public void setRaw​(java.lang.String variable,
                           double value)
        Set value in network table
        Parameters:
        variable - the value to change
        value - the new value
      • numberToDouble

        public double[] numberToDouble​(java.lang.Number[] numbers)
        Converts number array into double array
        Parameters:
        numbers - the number array to convert
        Returns:
        the double array
      • round

        public double round​(double numberToRound)
        Rounds input to the nearest hundereths place
        Parameters:
        numberToRound - the number to round
        Returns:
        the rounded number
      • setLEDMode

        public void setLEDMode​(double mode)
        Set the Limelight's LED State
        Parameters:
        mode -

        0: normal,

        1: force off,

        2: force blink,

        3: force on

      • getLEDMode

        public double getLEDMode()
        Get the Limelight's LED State
        Returns:

        0: normal,

        1: force off,

        2: force blink,

        3: force on

      • setCamMode

        public void setCamMode​(double mode)
        Sets the Limelight's Operation Mode
        Parameters:
        mode -

        0: Vision Proccesing,

        1: Driver Camera

      • getCamMode

        public double getCamMode()
        Gets the Limelight's Operation Mode
        Returns:

        0: Vision Proccesing,

        1: Driver Camera

      • setPipeline

        public void setPipeline​(double pipeline)
        Sets the Limelight's Current Pipeline
        Parameters:
        pipeline -

        Select Pipeline 0..9

      • setStream

        public void setStream​(double mode)
        Sets the Limelight's Streaming Mode
        Parameters:
        mode -

        0: Standard (Side By Side),

        1: PiP Main (Secoundary Stream In Lower Right Corner),

        2: PiP Secoundary (Primary Stream In Lower Right Corner)

      • getStream

        public double getStream()
        Gets the Limelight's Streaming Mode
        Returns:

        0: Standard (Side By Side),

        1: PiP Main (Secoundary Stream In Lower Right Corner),

        2: PiP Secoundary (Primary Stream In Lower Right Corner)

      • setSnapshot

        public void setSnapshot​(double mode)
        Allows Users To Take Snapshots During A Match
        Parameters:
        mode -

        0: Stop Taking Snapshots

        1: Take Two Snapshots Per Second

      • getSnapshot

        public double getSnapshot()
        Get Wether Users Are Allowed Take Snapshots During A Match
        Returns:

        0: Not Taking Snapshots

        1: Taking Two Snapshots Per Second

      • initSendable

        public void initSendable​(edu.wpi.first.util.sendable.SendableBuilder builder)
        Specified by:
        initSendable in interface edu.wpi.first.util.sendable.Sendable