Class Limelight
- java.lang.Object
-
- frc.robot.hardware.Limelight
-
- All Implemented Interfaces:
edu.wpi.first.util.sendable.Sendable
public class Limelight extends java.lang.Object implements edu.wpi.first.util.sendable.Sendablethis class contains all of the code and functions required for using a limelight
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classLimelight.ColorclassLimelight.Position
-
Constructor Summary
Constructors Constructor Description Limelight()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Limelight.Positionget3D()Results of a 3D position solution, 6 numbers: Translation (x,y,z) Rotation(pitch,yaw,roll)doublegetArea()Target AreadoublegetCamMode()Gets the Limelight's Operation ModeLimelight.ColorgetColor()Get the average HSV color underneath the crosshair region as a NumberArraydoublegetHeight()Vertical sidelength of the rough bounding boxdoublegetLEDMode()Get the Limelight's LED StatedoublegetLongestSidelength()Sidelength of longest side of the fitted bounding boxdoublegetPipe()True active pipeline index of the cameradoublegetRaw(java.lang.String variable)Get value from network tabledoublegetRotation()Skew or rotationdoublegetShortestSidelength()Sidelength of shortest side of the fitted bounding boxdoublegetSnapshot()Get Wether Users Are Allowed Take Snapshots During A MatchdoublegetStream()Gets the Limelight's Streaming ModedoublegetWidth()Horizontal sidelength of the rough bounding boxdoublegetX()Horizontal Offset From Crosshair To TargetdoublegetY()Vertical Offset From Crosshair To TargetdoubleimageLatency()The image capture latencyvoidinitSendable(edu.wpi.first.util.sendable.SendableBuilder builder)doublelatency()The pipeline’s latency contributiondouble[]numberToDouble(java.lang.Number[] numbers)Converts number array into double arraydoubleround(double numberToRound)Rounds input to the nearest hundereths placevoidsetCamMode(double mode)Sets the Limelight's Operation ModevoidsetLEDMode(double mode)Set the Limelight's LED StatevoidsetPipeline(double pipeline)Sets the Limelight's Current PipelinevoidsetRaw(java.lang.String variable, double value)Set value in network tablevoidsetSnapshot(double mode)Allows Users To Take Snapshots During A MatchvoidsetStream(double mode)Sets the Limelight's Streaming ModebooleantargetVisible()Whether the limelight has any valid targets
-
-
-
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 changevalue- 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:
initSendablein interfaceedu.wpi.first.util.sendable.Sendable
-
-