Package frc.robot

Class AprilTag

java.lang.Object
frc.robot.AprilTag
All Implemented Interfaces:
Comparable<AprilTag>

public class AprilTag extends Object implements Comparable<AprilTag>
This class is used to store the pose of the AprilTag relative to the camera.
  • Constructor Summary

    Constructors
    Constructor
    Description
    AprilTag(int id, String camName, edu.wpi.first.math.geometry.Translation3d camVector, edu.wpi.first.math.geometry.Translation3d transVector, edu.wpi.first.math.geometry.Rotation3d rotVector)
    Constructor for the AprilTag class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Compares one AptilTag to another.
    Gets the name of the camera.
    Get the pitch of the tag.
    edu.wpi.first.math.geometry.Pose3d
    Gets the pose of the tag relative to the camera.
    Get the roll of the tag.
    int
    Gets the ID of the tag.
    Get the X position of the tag.
    Get the Y position of the tag.
    Get the yaw of the tag.
    Get the Z position of the tag.
    Gets string of position values x,y,z and also pose of image.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • AprilTag

      public AprilTag(int id, String camName, edu.wpi.first.math.geometry.Translation3d camVector, edu.wpi.first.math.geometry.Translation3d transVector, edu.wpi.first.math.geometry.Rotation3d rotVector)
      Constructor for the AprilTag class.
      Parameters:
      id - The ID of the tag
      camName - The name of the camera
      camVector - The position of the camera relative to the tag
      transVector - The position of the tag relative to the camera
      rotVector - The orientation of the tag relative to the camera
  • Method Details

    • getPose

      public edu.wpi.first.math.geometry.Pose3d getPose()
      Gets the pose of the tag relative to the camera.
      Returns:
      Pose3d The pose of the tag relative to the camera
    • getX

      public Double getX()
      Get the X position of the tag.
      Returns:
      The double X position of the tag moving to the right and left
    • getY

      public Double getY()
      Get the Y position of the tag.
      Returns:
      The double Y position of the tag moving up and down, points down
    • getZ

      public Double getZ()
      Get the Z position of the tag.
      Returns:
      The double Z position of the tag or the forward direction
    • getRoll

      public Double getRoll()
      Get the roll of the tag.
      Returns:
      The double roll of the tag in radians
    • getYaw

      public Double getYaw()
      Get the yaw of the tag.
      Returns:
      The double yaw of the tag in radians
    • getPitch

      public Double getPitch()
      Get the pitch of the tag.
      Returns:
      The double pitch of the tag in radians
    • getCameraName

      public String getCameraName()
      Gets the name of the camera.
      Returns:
      The String name of the camera
    • getTagID

      public int getTagID()
      Gets the ID of the tag.
      Returns:
      The int ID of the tag
    • toString

      public String toString()
      Gets string of position values x,y,z and also pose of image.
      Overrides:
      toString in class Object
      Returns:
      TheString position with coordinates and pose
    • compareTo

      public int compareTo(AprilTag other)
      Compares one AptilTag to another.
      Specified by:
      compareTo in interface Comparable<AprilTag>
      Parameters:
      other -
      Returns:
      Anint used to compare two AprilTags