Record Class VisionPoseEstimate

java.lang.Object
java.lang.Record
yall.results.VisionPoseEstimate
Record Components:
cameraName - Name of the camera that produced the estimate.
pose - Estimated robot pose on the field, in WPILib blue-origin field coordinates.
timestampSeconds - When the image was captured, on the Timer.getMonotonicTimestamp() timebase.
tagIds - IDs of the AprilTags used.
averageTagDistanceMeters - Average distance from the camera to the tags used.
ambiguity - Pose ambiguity of a single-tag estimate, 0 to 1. 0 for multi-tag estimates, and Double.NaN if the camera doesn't report it.
headingAssisted - Whether the estimate used the robot heading from VisionCamera.setRobotOrientation(Rotation3d, AngularVelocity), so its rotation is that heading rather than the camera's.
stdDevs - Standard deviations of x (meters), y (meters) and heading (radians) for PoseEstimator.addVisionMeasurement(Pose2d, double, Matrix). Filled in by the VisionPoseFilter.

public record VisionPoseEstimate(String cameraName, Pose3d pose, double timestampSeconds, List<Integer> tagIds, double averageTagDistanceMeters, double ambiguity, boolean headingAssisted, Matrix<N3,N1> stdDevs) extends Record
A robot pose estimated from AprilTags, ready for a WPILib pose estimator.
  • Constructor Details

    • VisionPoseEstimate

      public VisionPoseEstimate(String cameraName, Pose3d pose, double timestampSeconds, List<Integer> tagIds, double averageTagDistanceMeters, double ambiguity, boolean headingAssisted, Matrix<N3,N1> stdDevs)
      Copies the tag list so the estimate can't change after it is made.
  • Method Details

    • unfiltered

      public static VisionPoseEstimate unfiltered(String cameraName, Pose3d pose, double timestampSeconds, List<Integer> tagIds, double averageTagDistanceMeters, double ambiguity, boolean headingAssisted)
      Creates an estimate whose standard deviations the filter hasn't filled in yet.
      Parameters:
      cameraName - Name of the camera.
      pose - Estimated robot pose.
      timestampSeconds - Capture timestamp.
      tagIds - IDs of the AprilTags used.
      averageTagDistanceMeters - Average distance to the tags used.
      ambiguity - Single-tag ambiguity, 0 for multi-tag, NaN if unknown.
      headingAssisted - Whether the robot heading was used.
      Returns:
      The estimate, with zero standard deviations.
    • tagCount

      public int tagCount()
      Number of AprilTags used.
      Returns:
      Tag count.
    • pose2d

      public Pose2d pose2d()
      The estimated pose on the floor.
      Returns:
      pose() as a Pose2d.
    • withStdDevs

      public VisionPoseEstimate withStdDevs(Matrix<N3,N1> stdDevs)
      A copy of this estimate with other standard deviations.
      Parameters:
      stdDevs - Standard deviations of x, y and heading.
      Returns:
      The copy.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • cameraName

      public String cameraName()
      Returns the value of the cameraName record component.
      Returns:
      the value of the cameraName record component
    • pose

      public Pose3d pose()
      Returns the value of the pose record component.
      Returns:
      the value of the pose record component
    • timestampSeconds

      public double timestampSeconds()
      Returns the value of the timestampSeconds record component.
      Returns:
      the value of the timestampSeconds record component
    • tagIds

      public List<Integer> tagIds()
      Returns the value of the tagIds record component.
      Returns:
      the value of the tagIds record component
    • averageTagDistanceMeters

      public double averageTagDistanceMeters()
      Returns the value of the averageTagDistanceMeters record component.
      Returns:
      the value of the averageTagDistanceMeters record component
    • ambiguity

      public double ambiguity()
      Returns the value of the ambiguity record component.
      Returns:
      the value of the ambiguity record component
    • headingAssisted

      public boolean headingAssisted()
      Returns the value of the headingAssisted record component.
      Returns:
      the value of the headingAssisted record component
    • stdDevs

      public Matrix<N3,N1> stdDevs()
      Returns the value of the stdDevs record component.
      Returns:
      the value of the stdDevs record component