Record Class VisionTarget
java.lang.Object
java.lang.Record
yall.results.VisionTarget
- Record Components:
yawDegrees- Horizontal angle from the crosshair to the target, positive right.pitchDegrees- Vertical angle from the crosshair to the target, positive up.areaPercent- Share of the image the target covers, 0 to 100.Double.NaNif the camera doesn't report it.fiducialId- AprilTag ID, or -1 if the target isn't an AprilTag.classId- Object detection class ID, or -1 if the target isn't a detected object.confidence- Object detection confidence, 0 to 1. 0 if the target isn't a detected object.ambiguity- AprilTag pose ambiguity, 0 to 1.Double.NaNif the camera doesn't report it.cameraToTarget- Transform from the camera to the target, if the camera solved it.
public record VisionTarget(double yawDegrees, double pitchDegrees, double areaPercent, int fiducialId, int classId, double confidence, double ambiguity, Optional<Transform3d> cameraToTarget)
extends Record
One target a camera sees, in the same form for every camera vendor.
Angles follow PhotonVision's convention: yaw is positive to the right of the crosshair, pitch is positive above it. Limelight's tx is already positive right; its ty is positive down, so the Limelight wrapper negates it.
-
Constructor Summary
ConstructorsConstructorDescriptionVisionTarget(double yawDegrees, double pitchDegrees, double areaPercent, int fiducialId, int classId, double confidence, double ambiguity, Optional<Transform3d> cameraToTarget) Creates an instance of aVisionTargetrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns the value of theambiguityrecord component.doubleReturns the value of theareaPercentrecord component.Returns the value of thecameraToTargetrecord component.intclassId()Returns the value of theclassIdrecord component.doubleReturns the value of theconfidencerecord component.final booleanIndicates whether some other object is "equal to" this one.intReturns the value of thefiducialIdrecord component.final inthashCode()Returns a hash code value for this object.booleanWhether the target is an AprilTag.booleanWhether the target came from object detection.doubleReturns the value of thepitchDegreesrecord component.final StringtoString()Returns a string representation of this record class.doubleReturns the value of theyawDegreesrecord component.
-
Constructor Details
-
VisionTarget
public VisionTarget(double yawDegrees, double pitchDegrees, double areaPercent, int fiducialId, int classId, double confidence, double ambiguity, Optional<Transform3d> cameraToTarget) Creates an instance of aVisionTargetrecord class.- Parameters:
yawDegrees- the value for theyawDegreesrecord componentpitchDegrees- the value for thepitchDegreesrecord componentareaPercent- the value for theareaPercentrecord componentfiducialId- the value for thefiducialIdrecord componentclassId- the value for theclassIdrecord componentconfidence- the value for theconfidencerecord componentambiguity- the value for theambiguityrecord componentcameraToTarget- the value for thecameraToTargetrecord component
-
-
Method Details
-
isAprilTag
public boolean isAprilTag()Whether the target is an AprilTag.- Returns:
- true if
fiducialId()is a tag ID.
-
isDetectedObject
public boolean isDetectedObject()Whether the target came from object detection.- Returns:
- true if
classId()is a class ID.
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
yawDegrees
public double yawDegrees()Returns the value of theyawDegreesrecord component.- Returns:
- the value of the
yawDegreesrecord component
-
pitchDegrees
public double pitchDegrees()Returns the value of thepitchDegreesrecord component.- Returns:
- the value of the
pitchDegreesrecord component
-
areaPercent
public double areaPercent()Returns the value of theareaPercentrecord component.- Returns:
- the value of the
areaPercentrecord component
-
fiducialId
public int fiducialId()Returns the value of thefiducialIdrecord component.- Returns:
- the value of the
fiducialIdrecord component
-
classId
-
confidence
public double confidence()Returns the value of theconfidencerecord component.- Returns:
- the value of the
confidencerecord component
-
ambiguity
-
cameraToTarget
Returns the value of thecameraToTargetrecord component.- Returns:
- the value of the
cameraToTargetrecord component
-