-
Notifications
You must be signed in to change notification settings - Fork 296
Moved Robot to camera transform to PhotonCamera #2440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Bobcat66
wants to merge
66
commits into
PhotonVision:2027
Choose a base branch
from
Bobcat66:issue_2095_2027_rebase
base: 2027
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
66 commits
Select commit
Hold shift + click to select a range
3410918
began transferring camera transform to photoncamera
Bobcat66 522d464
edited photon-serde message for PipelineResult, added camera transfor…
Bobcat66 9845216
updated PipelineResult protobuf
Bobcat66 955d597
fixed photoncamera constructor
Bobcat66 b27d8af
fixed photoncamerasim
Bobcat66 a9cb620
added back some PhotonPipelineResult constructors for backwards compa…
Bobcat66 47272a2
worked on java serde for the new PipelineResult
Bobcat66 9aa9c33
Hopefully compiles? Added serde code for C++
Bobcat66 b4180de
fixed photonpipelineresult constructor description
Bobcat66 8e5ef16
added old constructor for PhotonPipelineResult
Bobcat66 cd707bc
Hopefully fixed LegacyPhotonPoseEstimatorTest
Bobcat66 6e3759e
continued work on the c++ version of photonlib, still doesn't compile
Bobcat66 a780d94
CPP tests compile now i think
Bobcat66 4b0fd04
fixed cpp packet test
Bobcat66 0baf428
misc changes, fixed PhotonPipelineResult equality
Bobcat66 ddf4e1d
updated photon serde to support optional shimmed types
Bobcat66 b7efcd3
hopefully added optional WPI structs to photonserde
Bobcat66 4a2c9f0
added optional WPI structs to cpp photon serde
Bobcat66 6855851
removed robottocameratransform
Bobcat66 656fde1
istg if this fixes the CI build
Bobcat66 ac2b083
added python photonpipelineresult
Bobcat66 cbfdb45
ran wpiformat
Bobcat66 2b280b7
Merge pull request #1 from Bobcat66/photon-serde-patch
Bobcat66 d6090a1
Backend plumbing, added Camera position to frames
Bobcat66 a9e13c3
Merge branch 'main' of https://github.com/Bobcat66/photonvision
Bobcat66 87edd94
fixed null settables case in FileVisionSource
Bobcat66 c31b8f1
updated PhotonPoseEstimator
Bobcat66 63d7e10
updated LegacyPhotonPoseEstimatorTest
Bobcat66 e786a1d
hopefully fixed the problems in LegacyPhotonPoseEstimatorTest
Bobcat66 496c996
i fixed it yaaay
Bobcat66 38f6356
updated C++ PhotonPoseEstimator
Bobcat66 f7ebc15
ran wpiformat
Bobcat66 ac00977
updated C++ PhotonCamera NT
Bobcat66 93e6790
updated C++ and python photonCameras to publish robottocamera transform
Bobcat66 aed5bc6
fixed bug
Bobcat66 b91c2b6
fixed photon-docs build error
Bobcat66 824eb8d
fixed issue where the backend would read NT before photonlib publishe…
Bobcat66 92c67be
fixed bug in NTDataPublisher
Bobcat66 39f3989
ran wpiformat
Bobcat66 5a8b3ce
fixed rNTDataPublisher::onRobotToCameraChange, removed hacky robotToC…
Bobcat66 7ed34bc
updated photonlibpy pose estimator
Bobcat66 21c5ee8
made robotToCamera thread-safe
Bobcat66 3ffbd85
switched to a lockless atomicreference system
Bobcat66 1e925b7
ran spotlessApply
Bobcat66 fbcb712
ran wpiformat
Bobcat66 c7701e9
removed robotToCamera from photonposeestimator entirely
Bobcat66 b6f70a7
wpiformat
Bobcat66 970854a
updated cpp poseest example
Bobcat66 f45dd72
privated FileVisionSource getRobotToCamera()
Bobcat66 dc2af8f
linting
Bobcat66 9a67976
refactored backend
Bobcat66 c9ec8bb
fixed python photonPoseEstimator test
Bobcat66 bfea884
Merge branch 'issue_2095' into issue_2095_2027_rebase
Bobcat66 d020a5a
worked on rebase
Bobcat66 63817e0
wpiformat
Bobcat66 29b113b
it finally builds again horay
Bobcat66 3e0b03d
linting
Bobcat66 72a9d60
switched to using getters in photonposeestimator.java
Bobcat66 e6c1db9
linting
Bobcat66 97f4922
Merge branch '2027' into issue_2095_2027_rebase
Bobcat66 1862c18
added design doc
Bobcat66 5fc6a2e
linting
Bobcat66 245797f
added robot-to-camera design doc to index
Bobcat66 60ac857
moved robotToCamera transform to VisionModule
Bobcat66 4190a35
added robotToCamera transform buffer with lerp
Bobcat66 dee905c
updated python and cpp photonlibs
Bobcat66 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,4 +6,5 @@ image-rotation | |
| time-sync | ||
| camera-matching | ||
| e2e-latency | ||
| robot-to-camera | ||
| ``` | ||
14 changes: 14 additions & 0 deletions
14
docs/source/docs/contributing/design-descriptions/robot-to-camera.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # Robot to Camera | ||
|
|
||
| ## How 3D pose estimation works | ||
|
|
||
| At its core, Photonvision's 3D pose estimation is built around solving the Perspective-n-Point (PnP) problem. The PnP problem is essentially, 'given a set of points in 3D space, and their projections on a 2D image, determine the pose of the camera'. In photonvision's case, the points are the corners of one or more apriltags. | ||
| However, this leaves us with the camera's pose, *not* the robot's pose. The solution, of course, is to apply an offset. For 3D Pose estimation, Photonvision associates to each camera a `Transform3d` object, representing a vector encoding the 6DOF transformation from the robot (or, rather, the point on the robot considered to be its center) to the camera, and the final step of pose estimation is to transform the camera's pose (that got spit out of the PnP solver) by the inverse of this vector, yielding an estimate of the robot's pose. | ||
|
|
||
| ## What does the plumbing look like? | ||
|
|
||
| The `PhotonCamera` object is (optionally) passed a `Transform3d` object by the Robot code, corresponding to the robot-to-camera transformation. This `Transform3d` (if passed) is transmitted to the coprocessor by the `PhotonCamera`. The coprocessor then appends that `Transform3d` to every result it sends back to the robot controller, where the `PhotonPoseEstimator` object then applies the transformation to the camera pose (If no `Transform3d` is passed to `PhotonCamera`, then no `Transform3d` is appended to the results, and `PhotonPoseEstimator` simply won't work. The result stores the `Transform3d` as an optional) | ||
|
|
||
| ## That seems complicated and silly. Why not just keep the robot to camera transform in PhotonLib? | ||
|
|
||
| We used to! However, a new algorithm for fusing gyroscopic data to PnP pose observations has been added to PhotonVision, Constrained PnP, offering significantly improved accuracy and stability. Notably, this algorithm requires the robot-to-camera transform to run properly. In previous seasons, this wasn't a problem, as Constrained PnP ran entirely on the RoboRIO anyways, in order to access robot gyro data. However, Constrained PnP is very computationally expensive, and so work is being done to offload the work to the coprocessor, and expose gyro data to the coprocessor. The switch to having the robot-to-camera transform exposed to the coprocessor over NetworkTables and becoming an integrated part of Photonvision results is to facilitate the offloading of the Constrained PnP workload (and other estimation workloads that require Gyroscopic data) to the coprocessor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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