Record Class VisionResult
java.lang.Object
java.lang.Record
yall.results.VisionResult
- Record Components:
cameraName- Name of the camera that produced the frame.timestampSeconds- When the image was captured, on theTimer.getMonotonicTimestamp()timebase that WPILib's pose estimators use.latencyMillis- Time from capture to the result reaching the robot, in milliseconds.targets- Targets in the frame, best first.
public record VisionResult(String cameraName, double timestampSeconds, double latencyMillis, List<VisionTarget> targets)
extends Record
One processed camera frame, in the same form for every camera vendor.
-
Constructor Summary
ConstructorsConstructorDescriptionVisionResult(String cameraName, double timestampSeconds, double latencyMillis, List<VisionTarget> targets) Copies the target list so the result can't change after it is made. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecameraNamerecord component.final booleanIndicates whether some other object is "equal to" this one.The AprilTags in the frame.The best target in the frame, as ranked by the camera.The detected objects in the frame.final inthashCode()Returns a hash code value for this object.booleanWhether the frame has any targets.doubleReturns the value of thelatencyMillisrecord component.targets()Returns the value of thetargetsrecord component.doubleReturns the value of thetimestampSecondsrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
VisionResult
public VisionResult(String cameraName, double timestampSeconds, double latencyMillis, List<VisionTarget> targets) Copies the target list so the result can't change after it is made.
-
-
Method Details
-
hasTargets
public boolean hasTargets()Whether the frame has any targets.- Returns:
- true if
targets()isn't empty.
-
getBestTarget
The best target in the frame, as ranked by the camera.- Returns:
- The first target, or empty if there are none.
-
getAprilTags
The AprilTags in the frame.- Returns:
- Targets with a fiducial ID.
-
getDetectedObjects
The detected objects in the frame.- Returns:
- Targets with an object detection 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. -
cameraName
Returns the value of thecameraNamerecord component.- Returns:
- the value of the
cameraNamerecord component
-
timestampSeconds
public double timestampSeconds()Returns the value of thetimestampSecondsrecord component.- Returns:
- the value of the
timestampSecondsrecord component
-
latencyMillis
public double latencyMillis()Returns the value of thelatencyMillisrecord component.- Returns:
- the value of the
latencyMillisrecord component
-
targets
-