diff --git a/photon-lib/src/main/java/org/photonvision/PhotonPoseEstimator.java b/photon-lib/src/main/java/org/photonvision/PhotonPoseEstimator.java index f93c499140..6b217c9b73 100644 --- a/photon-lib/src/main/java/org/photonvision/PhotonPoseEstimator.java +++ b/photon-lib/src/main/java/org/photonvision/PhotonPoseEstimator.java @@ -408,8 +408,8 @@ private Optional update( return Optional.empty(); } - if (estimatedPose.isEmpty()) { - lastPose = null; + if (estimatedPose.isPresent()) { + lastPose = estimatedPose.get().estimatedPose; } return estimatedPose; diff --git a/photon-lib/src/main/native/cpp/photon/PhotonPoseEstimator.cpp b/photon-lib/src/main/native/cpp/photon/PhotonPoseEstimator.cpp index 30bc6de2df..d14394b999 100644 --- a/photon-lib/src/main/native/cpp/photon/PhotonPoseEstimator.cpp +++ b/photon-lib/src/main/native/cpp/photon/PhotonPoseEstimator.cpp @@ -186,6 +186,9 @@ std::optional PhotonPoseEstimator::Update( ret = std::nullopt; } + if (ret) { + lastPose = ret.value().estimatedPose; + } return ret; }