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 TypeMethodDescriptionvoid
Set LL LED's to blinkdouble
double
double
getDistanceToTarget
(double targetHeight) get distance in meters to a targetdouble
edu.wpi.first.math.geometry.Pose3d
double
Returns the timestamp of the MEGATAG1 pose estimation from the Limelight camera.edu.wpi.first.math.geometry.Pose2d
double
Returns the timestamp of the MEGATAG2 pose estimation from the Limelight camera.getName()
double
Deprecated, for removal: This API element is subject to removal in a future version.double
double
double
getTagTA()
double
getTagTx()
double
double
boolean
boolean
boolean
Checks if the camera is connected by looking for an empty botpose array from camera.boolean
boolean
void
Prints the vision, estimated, and odometry pose to SmartDashboardvoid
sendInvalidStatus
(String message) void
sendValidStatus
(String message) void
setIMUmode
(int mode) setIntegrating
(boolean isIntegrating) void
setLEDMode
(boolean enabled) Sets the LED mode of the LL.void
setLimelightPipeline
(int pipelineIndex) setLogStatus
(String logStatus) void
setRobotOrientation
(double degrees) void
setRobotOrientation
(double degrees, double angularRate) setTagStatus
(String tagStatus) boolean
-
Constructor Details
-
Limelight
-
Limelight
-
Limelight
-
Limelight
-
Limelight
-
-
Method Details
-
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
-
getMegaTag2_PoseEstimate
-
hasAccuratePose
public boolean hasAccuratePose() -
getDistanceToTagFromCamera
public double getDistanceToTagFromCamera()- 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:
-
sendValidStatus
-
sendInvalidStatus
-
setLimelightPipeline
public void setLimelightPipeline(int pipelineIndex) - Parameters:
pipelineIndex
- use pipeline indexes inVision.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
- Returns:
this
.
-
getCameraName
-
getLogStatus
-
setLogStatus
- Returns:
this
.
-
getTagStatus
-
setTagStatus
- Returns:
this
.
-