How to get individual april tags on Photonvision

In an April Tag pipeline, how do I make it so only one april tag can be seen? For example, if I have aprtil tags 1 and 2 side-by-side, how do I make it so that only april tag 1 is detected, and april tag 2 is ignored? This works in Limelight, but I don’t know if it is possible with Photonvision.

Can you explain what your end goal is? For pose estimation, more tags help. PV also tells you each tag it sees through NT. If you want to only detect one, you can have logic to select a single tag from the list of detections.

We want to detect a single april tag and press a button to center towards that specific one. How would I get the logic to select a single tag?

Follow the documentation.
Put together,

PhotonCamera camera = new PhotonCamera("photonvision");
var result = camera.getLatestResult();
if(result.hasTargets()) {
  PhotonTrackedTarget target = result.getBestTarget();
  int targetID = target.getFiducialId();

If you want a custom getBestTarget implementation, you can make one in conjunction w/ List<PhotonTrackedTarget> targets = result.getTargets();

1 Like