Package frc.robot
Class AprilTag
java.lang.Object
frc.robot.AprilTag
- All Implemented Interfaces:
Comparable<AprilTag>
This class is used to store the pose of the AprilTag relative to the camera.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Compares one AptilTag to another.Gets the name of the camera.getPitch()
Get the pitch of the tag.edu.wpi.first.math.geometry.Pose3d
getPose()
Gets the pose of the tag relative to the camera.getRoll()
Get the roll of the tag.int
getTagID()
Gets the ID of the tag.getX()
Get the X position of the tag.getY()
Get the Y position of the tag.getYaw()
Get the yaw of the tag.getZ()
Get the Z position of the tag.toString()
Gets string of position values x,y,z and also pose of image.
-
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 tagcamName
- The name of the cameracamVector
- The position of the camera relative to the tagtransVector
- The position of the tag relative to the camerarotVector
- 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
Get the X position of the tag.- Returns:
- The
double
X position of the tag moving to the right and left
-
getY
Get the Y position of the tag.- Returns:
- The
double
Y position of the tag moving up and down, points down
-
getZ
Get the Z position of the tag.- Returns:
- The
double
Z position of the tag or the forward direction
-
getRoll
Get the roll of the tag.- Returns:
- The
double
roll of the tag in radians
-
getYaw
Get the yaw of the tag.- Returns:
- The
double
yaw of the tag in radians
-
getPitch
Get the pitch of the tag.- Returns:
- The
double
pitch of the tag in radians
-
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
Gets string of position values x,y,z and also pose of image. -
compareTo
Compares one AptilTag to another.- Specified by:
compareTo
in interfaceComparable<AprilTag>
- Parameters:
other
-- Returns:
- An
int
used to compare two AprilTags
-