distanceToTag

fun Pose2d.distanceToTag(tagId: Int, fieldLayout: AprilTagFieldLayout = AprilTagFields.kDefaultField.layout): Distance?

Calculates the distance from a robot pose to a specific AprilTag.

Receiver

Pose2d The robot's current pose.

Return

Distance The distance to the tag, or null if the tag doesn't exist.

Parameters

tagId

The AprilTag ID to calculate distance to.

fieldLayout

The field layout containing tag positions.