Skip to content

Moved Robot to camera transform to PhotonCamera#2440

Open
Bobcat66 wants to merge 66 commits intoPhotonVision:2027from
Bobcat66:issue_2095_2027_rebase
Open

Moved Robot to camera transform to PhotonCamera#2440
Bobcat66 wants to merge 66 commits intoPhotonVision:2027from
Bobcat66:issue_2095_2027_rebase

Conversation

@Bobcat66
Copy link
Copy Markdown
Contributor

Description

RobotToCamera transform has been moved to PhotonCamera, and is broadcast over NetworkTables to the coprocessor. All pipeline results are appended with an optional camera transform, and PhotonPoseEstimator no longer has a robot-to-camera transform of its own, instead reading them directly from the results. This originally was made for and tested on the 2026 version, and as far as I can tell it works, but some things might have broken while rebasing to 2027

Closes #2095

Meta

Merge checklist:

  • Pull Request title is short, imperative summary of proposed changes
  • The description documents the what and why, including events that led to this PR
  • 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 all settings going back to the previous seasons's last release (seasons end after champs ends)
  • 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
  • If this PR adds a dependency, the license has been checked for compatibility and steps taken to follow it

Bobcat66 and others added 30 commits March 5, 2026 01:48
@Bobcat66 Bobcat66 requested a review from a team as a code owner April 23, 2026 02:01
@github-actions github-actions Bot added documentation Anything relating to https://docs.photonvision.org photonlib Things related to the PhotonVision library backend Things relating to photon-core and photon-server labels Apr 23, 2026
Copy link
Copy Markdown
Contributor

@mcm001 mcm001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see where NT changes are plumbed into pipelines and then where the current value is telemetered. Is this value used for multitag yet?

I'm also concerned about latency compensation here, for cases where the camera is moving

}

private void onRobotToCameraChange(NetworkTableEvent entryNotification) {
// HACK: the entryNotification's value can't be cast to Transform3d, so we read directly from
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worth making an upstream issue against wpilib to support structs here

private CVPipeline currentUserPipeline = driverModePipeline;

/** The current robot to camera transform. */
private AtomicReference<Transform3d> robotToCamera = new AtomicReference<>();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does pipeline manager make sense to hold this data? I think it might make sense to leave this class only concerned with switching pipelines.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I originally structured it the way i did because in my mind the pipelineManager was 'object that handles everything that has to do with the pipeline', and the robotToCamera is conceptually (IMO) part of the pipeline, Looking back at the code, I agree that it might make more sense to move the atomic reference to the VisionModule. I can update the PR.

@Bobcat66 Bobcat66 requested a review from mcm001 April 26, 2026 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Things relating to photon-core and photon-server documentation Anything relating to https://docs.photonvision.org photonlib Things related to the PhotonVision library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants