Skip to content

[photon-lib] Add PhotonPoseEstimator.resetHeadingData()#1933

Merged
samfreund merged 3 commits intoPhotonVision:mainfrom
bryceroethel:clear-heading-data
Apr 26, 2025
Merged

[photon-lib] Add PhotonPoseEstimator.resetHeadingData()#1933
samfreund merged 3 commits intoPhotonVision:mainfrom
bryceroethel:clear-heading-data

Conversation

@bryceroethel
Copy link
Contributor

@bryceroethel bryceroethel commented Apr 25, 2025

Description

When using PNP_DISTANCE_TRIG_SOLVE, heading data provided prior to a pose or rotation reset (examples including resetting odometry at the start of autonomous, or zeroing the robot's gyro) may be utilized when calculating future pose estimates, which can cause unpredictable behavior in some scenarios. This PR adds PhotonPoseEstimator.resetHeadingData(), giving users the option to manually clear the heading buffer to avoid the aforementioned issue.

Here's a log from one of my team's practice matches, where we observed irregular vision measurements at the start of autonomous, after the robot's pose was reset. Afterwards, we copied PhotonPoseEstimator into our robot code and implemented the method added by this PR, which resolved the problem. Green ghosts are the poses given by Photon, the solid model is our estimated pose.

2025-04-25.17-07-09.mp4

Meta

Merge checklist:

  • Pull Request title is short, imperative summary of proposed changes
  • The description documents the what and why
  • If this PR changes behavior or adds a feature, user documentation is updated
  • If this PR touches photon-serde, all messages have been regenerated and hashes have not changed unexpectedly
  • If this PR touches configuration, this is backwards compatible with settings back to v2024.3.1
  • If this PR touches pipeline settings or anything related to data exchange, the frontend typing is updated
  • If this PR addresses a bug, a regression test for it is added

@bryceroethel bryceroethel requested a review from a team as a code owner April 25, 2025 21:18
@samfreund
Copy link
Member

LGTM, but as I'm not that familiar with the pose estimator, I'll leave it to someone else to approve.

@bryceroethel bryceroethel changed the title [photon-lib] Add PhotonPoseEstimator.clearHeadingData() [photon-lib] Add PhotonPoseEstimator.resetHeadingData() Apr 25, 2025
@samfreund samfreund merged commit c1b0c8a into PhotonVision:main Apr 26, 2025
39 checks passed
@samfreund samfreund mentioned this pull request May 5, 2025
7 tasks
samfreund pushed a commit to samfreund/photonvision that referenced this pull request Jun 28, 2025
@Gold856 Gold856 added the photonlib Things related to the PhotonVision library label Jul 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

photonlib Things related to the PhotonVision library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants