Updated PhotonPoseEstimator examples#1765
Conversation
|
Broadly looks good! Do you think we should move towards RLIs instead of code snippets? |
I would be happy to update it to do so from the photonvision examples if that makes sense to you. It does for me now that I'm considering it. In the PV repo examples (or at least Java), there are like 10 lines for sim before the method is closed. Should I do two RLIs around it, or just manually write the end bracket? |
We'd need to update the examples for this |
|
@mcm001 I've started working on using RLIs and so far my only concern is how certain values are defined and referenced in the examples. For instance, kRobotToCam and kTagLayout are defined in Constants.java, but referenced in Vision.java. When I do an RLI, I would have to leave out kRobotToCam or do two separate code blocks to include it. I am leaning towards modifying the page so that it aligns more with the model of having the camera defined separately, and implementing separate sections for kRobotToCam, kTagLayout, camera, and pose estimator definitions which would more thoroughly explain them. On the other hand, I could keep the current model of three categories and just double up on code blocks to add necessary code. The only other option I see would be leaving out something like the transform, but that information seems valuable. I wanted to check with you that the first idea (modifying the section structure) is okay before doing it so that I don't put time into it if it's not something you'd like in the end. I think it would be better overall for people to understand how to use the pose estimator anyways. |
|
Yeah feel free to rip and tear at organization if you think it makes more sense. Cc @Gold856 re: inspector and RLIs |
|
From this it looks like python still uses the previous model of providing the camera in the constructor. With that in mind, I think these docs are accurate and I used RLIs for everything. |
| You should be updating your [drivetrain pose estimator](https://docs.wpilib.org/en/latest/docs/software/advanced-controls/state-space/state-space-pose-estimators.html) with the result from the `RobotPoseEstimator` every loop using `addVisionMeasurement()`. TODO: add example note | ||
| You should be updating your [drivetrain pose estimator](https://docs.wpilib.org/en/latest/docs/software/advanced-controls/state-space/state-space-pose-estimators.html) with the result from the `PhotonPoseEstimator` every loop using `addVisionMeasurement()`. TODO: add example note | ||
|
|
||
| ## Additional `PhotonPoseEstimator` Methods |
There was a problem hiding this comment.
Consider directly linking to https://javadocs.photonvision.org/org/photonvision/PhotonPoseEstimator.html and https://cppdocs.photonvision.org/classphoton_1_1_photon_pose_estimator.html here. If we need to beef up these javadocs, let's do that instead?
## Description Updates the PhotonPoseEstimator programming documentation page to reflect the new PhotonPoseEstimator. and add a more comprehensive step-by-step tutorial using code from the PV Pose Estimation examples. Updates various code examples to ensure they are matching the latest documentation or example code on GitHub. This PR is a successor of, and therefore closes PhotonVision#1765. This PR is blocked by PhotonVision#1706, as the linked PR updates examples. Closes PhotonVision#1757 and closes PhotonVision#1800 and closes PhotonVision#1632 and closes PhotonVision#1773 and closes PhotonVision#1465. ## Meta Merge checklist: - [x] Pull Request title is [short, imperative summary](https://cbea.ms/git-commit/) of proposed changes - [x] The description documents the _what_ and _why_ - [x] If this PR changes behavior or adds a feature, user documentation is updated - [x] If this PR touches photon-serde, all messages have been regenerated and hashes have not changed unexpectedly - [x] If this PR touches configuration, this is backwards compatible with settings back to v2024.3.1 - [x] If this PR touches pipeline settings or anything related to data exchange, the frontend typing is updated - [x] If this PR addresses a bug, a regression test for it is added --------- Co-authored-by: Kevin Reas <76408202+PaarkG@users.noreply.github.com> Co-authored-by: Matt Morley <matthew.morley.ca@gmail.com>
Attempts to resolve #1759 and #1757
Updated the AprilTags and PhotonPoseEstimator docs page to reflect the new PhotonPoseEstimator which no longer takes a camera in the constructor, and now uses getAllUnreadResults rather than getLatestResult.
First time writing C++ so please review my syntax :)
Not sure about the third python section either, as I couldn't find an updated version of the python documentation.