Fix non-checked optional in mulit-tag (#808)

* Fix non-checked optional in mulit-tag

* Fix fallback return

* Run format
This commit is contained in:
Matt
2023-02-14 19:50:17 -05:00
committed by GitHub
parent 9ac1050264
commit a4554d9bd4

View File

@@ -331,12 +331,19 @@ public class PhotonPoseEstimator {
if (result.getTargets().size() < 2) {
// Run fallback strategy instead
update(result, this.multiTagFallbackStrategy);
return update(result, this.multiTagFallbackStrategy);
}
for (var target : result.getTargets()) {
visCorners.addAll(target.getDetectedCorners());
Pose3d tagPose = fieldTags.getTagPose(target.getFiducialId()).get();
var tagPoseOpt = fieldTags.getTagPose(target.getFiducialId());
if (tagPoseOpt.isEmpty()) {
reportFiducialPoseError(target.getFiducialId());
continue;
}
var tagPose = tagPoseOpt.get();
// actual layout poses of visible tags -- not exposed, so have to recreate
knownVisTags.add(new AprilTag(target.getFiducialId(), tagPose));