Skip to content

Commit

Permalink
Store the last pose on update (PhotonVision#1207)
Browse files Browse the repository at this point in the history
* Store the last pose on update

* Don't clear lastPose if pose isn't calculated

---------

Co-authored-by: Mohammad Durrani <[email protected]>
  • Loading branch information
ArchdukeTim and mdurrani808 authored Feb 5, 2024
1 parent 7666f15 commit 0eb0a4e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,8 @@ private Optional<EstimatedRobotPose> update(
return Optional.empty();
}

if (estimatedPose.isEmpty()) {
lastPose = null;
if (estimatedPose.isPresent()) {
lastPose = estimatedPose.get().estimatedPose;
}

return estimatedPose;
Expand Down
3 changes: 3 additions & 0 deletions photon-lib/src/main/native/cpp/photon/PhotonPoseEstimator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ std::optional<EstimatedRobotPose> PhotonPoseEstimator::Update(
ret = std::nullopt;
}

if (ret) {
lastPose = ret.value().estimatedPose;
}
return ret;
}

Expand Down

0 comments on commit 0eb0a4e

Please sign in to comment.