When multiple April Tags are in sight through the Limelight, how can I code it so that it can only focus on one on the April tags?

I’m trying to avoid using the software of the limelight as I’m new to coding and that I’d like to actually use it during competition

The limelight will automatically “focus” on the closest april tag to it. If you are looking at your limelight’s feed, and it can see 2 Apriltags, it will have a thicker box around the one that it is currently giving certain results for. That being said, what exactly are you trying to do?

There’s this specific command our robot does when it sees an april tag, however, it consistently picks up the wrong april tag. I want it so that it not only NOT focuses on any random april tag, but to be able to customize it so I can change which april tag to focus on

You can create multiple pipelines on your limelight and set them to only track specific April tags id numbers. Then in code you can tell it to switch to using the pipeline that filters as you need.

1 Like
  public static LimelightTarget_Fiducial[] getVisibleTargets(String limelightName) {
        return LimelightHelpers.getLatestResults(limelightName).targetingResults.targets_Fiducials;
    }

 public static LimelightTarget_Fiducial getTargetFromID(String limelightName, int id) {
        LimelightTarget_Fiducial[] results = getVisibleTargets(limelightName);
        for(LimelightTarget_Fiducial fid: results) {
            if(fid.fiducialID == id) {
                return fid;
            }
        }
        return null;
    }

Try this, with the bottom method u can get a tag of a specific ID. (Uses LimelightHelpers lib)