Package frc.spectrumLib.vision
Class Limelight
java.lang.Object
frc.spectrumLib.vision.Limelight
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidSet LL LED's to blinkdoubleGets the ID of the apriltag most centered in the LL's view (or based on differentdoubleGet the distance of the 2d vector from the camera to closest apriltagdoublegetDistanceToTarget(double targetHeight) get distance in meters to a targetdoubleGet the horizontal offset from crosshair to targetedu.wpi.first.math.geometry.Pose3dGet the corresponding LL Pose3d (MEGATAG1) for the alliance in DriverStation.javadoubleReturns the timestamp of the MEGATAG1 pose estimation from the Limelight camera.edu.wpi.first.math.geometry.Pose2dGet the corresponding LL Pose2d (MEGATAG1) for the alliance in DriverStation.javadoubleReturns the timestamp of the MEGATAG2 pose estimation from the Limelight camera.getName()doubleDeprecated, for removal: This API element is subject to removal in a future version.doubledoubledoublegetTagTA()doublegetTagTx()doubledoubleGet the vertical offset from crosshair to targetbooleanbooleanbooleanChecks if the camera is connected by looking for an empty botpose array from camera.booleanbooleanChecks if the LL sees multiple tagsvoidPrints the vision, estimated, and odometry pose to SmartDashboardvoidsendInvalidStatus(String message) voidsendValidStatus(String message) voidsetIMUmode(int mode) voidsetIntegrating(boolean isIntegrating) voidsetLEDMode(boolean enabled) Sets the LED mode of the LL.voidsetLimelightPipeline(int pipelineIndex) Sets the LL pipeline to the given index.voidsetLogStatus(String logStatus) voidsetRobotOrientation(double degrees) Sets the robot orientation in degrees for the Limelight's internal IMU.voidsetRobotOrientation(double degrees, double angularRate) voidsetTagStatus(String tagStatus) booleanReturns whether the LL has any valid targets (April tags or other vision targets)
-
Constructor Details
-
Limelight
-
Limelight
-
Limelight
-
Limelight
-
Limelight
-
-
Method Details
-
getName
-
isAttached
public boolean isAttached() -
getHorizontalOffset
public double getHorizontalOffset()Get the horizontal offset from crosshair to target- Returns:
- Horizontal Offset From Crosshair To Target (LL1: -27 degrees to 27 degrees / LL2: -29.8 to 29.8 degrees)
-
getVerticalOffset
public double getVerticalOffset()Get the vertical offset from crosshair to target- 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)- Returns:
- Whether the LL has any valid targets (April tags or other vision targets)
-
multipleTagsInView
public boolean multipleTagsInView()Checks if the LL sees multiple tags- Returns:
- whether the LL sees multiple tags or not
-
getTagCountInView
public double getTagCountInView() -
getClosestTagID
public double getClosestTagID()Gets the ID of the apriltag most centered in the LL's view (or based on different- 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()Get the corresponding LL Pose3d (MEGATAG1) for the alliance in DriverStation.java- Returns:
- the corresponding LL Pose3d (MEGATAG1) for the alliance in DriverStation.java
-
getMegaTag2_Pose2d
public edu.wpi.first.math.geometry.Pose2d getMegaTag2_Pose2d()Get the corresponding LL Pose2d (MEGATAG1) for the alliance in DriverStation.java- Returns:
- the corresponding LL Pose3d (MEGATAG2) for the alliance in DriverStation.java
-
getMegaTag1_PoseEstimate
-
getMegaTag2_PoseEstimate
-
hasAccuratePose
public boolean hasAccuratePose() -
getDistanceToTagFromCamera
public double getDistanceToTagFromCamera()Get the distance of the 2d vector from the camera to closest apriltag- Returns:
- the distance of the 2d vector from the camera to closest apriltag
-
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, 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:
- distance in meters to a target
-
sendValidStatus
-
sendInvalidStatus
-
setLimelightPipeline
public void setLimelightPipeline(int pipelineIndex) Sets the LL pipeline to the given index.- Parameters:
pipelineIndex- use pipeline indexes inVision.VisionConfig
-
setRobotOrientation
public void setRobotOrientation(double degrees) Sets the robot orientation in degrees for the Limelight's internal IMU. -
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 void setIntegrating(boolean isIntegrating) -
getCameraName
-
getLogStatus
-
setLogStatus
-
getTagStatus
-
setTagStatus
-