distanceToClosestTag

fun Pose2d.distanceToClosestTag(fieldLayout: AprilTagFieldLayout = AprilTagFields.kDefaultField.layout): Distance?

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

Receiver

Pose2d The robot's current pose.

Return

Distance The distance to the closest tag, or null if no tags exist.

Parameters

fieldLayout

The field layout containing tag positions.