-
Notifications
You must be signed in to change notification settings - Fork 293
Examples Clean-Up #1408
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
Merged
Merged
Examples Clean-Up #1408
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
6f69ec8
Split simulation to be per-language, since support will generally var…
gerth2 cc7af9f
Strategies rework and streamline
gerth2 e0aac4f
WIP cleaning up sim estimates
gerth2 3157588
Basic streamlining to robot example. Looks Functional.
gerth2 e819980
wip adding GamepieceLauncher
gerth2 1b4e840
Added gamepiece launcher logic
gerth2 10712fe
Aim-at-target simple strategy added.
gerth2 aec81dc
Aim and Range working too
gerth2 942b884
Even more cleanup
gerth2 731d8b5
Moar Clean
gerth2 96d34e7
Code Block cleanup/commonization
gerth2 d6c37ea
RLI's are still todo, but build didn't like my toto strategy
gerth2 db9cc4b
another attempt
gerth2 d79c8d5
RLI cleanup
gerth2 385154b
moar cleanup
gerth2 306a7ff
WIP C++example rework. poseest working decently now.
gerth2 40200dc
aim at target example base WIP
gerth2 8c0b01f
AimAtTarget working
gerth2 d01b35b
Aim And Range working too
gerth2 5847be8
what the heck is an explicit falcon
gerth2 bbaf120
whip python
gerth2 601d2e7
looks like python can run examples
gerth2 63c27a3
more WIP python swerve
gerth2 d8b6b7c
wip python logging
gerth2 137fa36
More Python WIP
gerth2 bda58ad
Swerve simulation functional
gerth2 1da3519
Python examples fixed up and added
gerth2 9dee7a2
whippyformat and copyright stuff
gerth2 56513ce
PoseEst sample code added. Streamlined other examples.
gerth2 adb3098
RLI's updated
gerth2 5d4f588
moar RLI tweaks
gerth2 ab27254
i am very bad at software
gerth2 be8b25b
Removed broken/unneded bat file
gerth2 5a1c491
Some review comments
gerth2 cb76743
more review comments
gerth2 21ae9eb
Moto's review comments pt 1
gerth2 4b82755
spppppppoooooooooooooooooooooooootttttttttttttttttttttttttlllllllllll…
gerth2 ed4556c
Merge branch 'master' into example-docs-cleanup
gerth2 b3aee41
Pose Estimation Punchline
gerth2 ea9c9ad
bigger GIf
gerth2 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,45 +1,55 @@ | ||
| # Aiming at a Target | ||
|
|
||
| The following example is from the PhotonLib example repository ([Java](https://github.com/PhotonVision/photonvision/tree/master/photonlib-java-examples/aimattarget)/[C++](https://github.com/PhotonVision/photonvision/tree/master/photonlib-cpp-examples/aimattarget)). | ||
| The following example is from the PhotonLib example repository ([Java](https://github.com/PhotonVision/photonvision/tree/master/photonlib-java-examples/aimattarget)). | ||
|
|
||
| ## Knowledge and Equipment Needed | ||
|
|
||
| - Robot with a vision system running PhotonVision | ||
| - Target | ||
| - Ability to track a target by properly tuning a pipeline | ||
| - A Robot | ||
| - A camera mounted rigidly to the robot's frame, cenetered and pointed forward. | ||
| - A coprocessor running PhotonVision with an AprilTag or Aurco 2D Pipeline. | ||
| - [A printout of Apriltag 7](https://firstfrc.blob.core.windows.net/frc2024/FieldAssets/Apriltag_Images_and_User_Guide.pdf), mounted on a rigid and flat surface. | ||
|
|
||
| ## Code | ||
|
|
||
| Now that you have properly set up your vision system and have tuned a pipeline, you can now aim your robot/turret at the target using the data from PhotonVision. This data is reported over NetworkTables and includes: latency, whether there is a target detected or not, pitch, yaw, area, skew, and target pose relative to the robot. This data will be used/manipulated by our vendor dependency, PhotonLib. The documentation for the Network Tables API can be found {ref}`here <docs/additional-resources/nt-api:Getting Target Information>` and the documentation for PhotonLib {ref}`here <docs/programming/photonlib/adding-vendordep:What is PhotonLib?>`. | ||
| Now that you have properly set up your vision system and have tuned a pipeline, you can now aim your robot at an AprilTag using the data from PhotonVision. The *yaw* of the target is the critical piece of data that will be needed first. | ||
|
|
||
| For this simple example, only yaw is needed. | ||
| Yaw is reported to the roboRIO over Network Tables. PhotonLib, our vender dependency, is the easiest way to access this data. The documentation for the Network Tables API can be found {ref}`here <docs/additional-resources/nt-api:Getting Target Information>` and the documentation for PhotonLib {ref}`here <docs/programming/photonlib/adding-vendordep:What is PhotonLib?>`. | ||
|
|
||
gerth2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| In this example, while the operator holds a button down, the robot will turn towards the goal using the P term of a PID loop. To learn more about how PID loops work, how WPILib implements them, and more, visit [Advanced Controls (PID)](https://docs.wpilib.org/en/stable/docs/software/advanced-control/introduction/index.html) and [PID Control in WPILib](https://docs.wpilib.org/en/stable/docs/software/advanced-controls/controllers/pidcontroller.html#pid-control-in-wpilib). | ||
| In this example, while the operator holds a button down, the robot will turn towards the AprilTag using the P term of a PID loop. To learn more about how PID loops work, how WPILib implements them, and more, visit [Advanced Controls (PID)](https://docs.wpilib.org/en/stable/docs/software/advanced-control/introduction/index.html) and [PID Control in WPILib](https://docs.wpilib.org/en/stable/docs/software/advanced-controls/controllers/pidcontroller.html#pid-control-in-wpilib). | ||
|
|
||
| ```{eval-rst} | ||
| .. tab-set:: | ||
|
|
||
| .. tab-item:: Java | ||
|
|
||
| .. rli:: https://raw.githubusercontent.com/PhotonVision/photonvision/ebef19af3d926cf87292177c9a16d01b71219306/photonlib-java-examples/aimattarget/src/main/java/frc/robot/Robot.java | ||
| .. rli:: https://raw.githubusercontent.com/gerth2/photonvision/adb3098fbe0cdbc1a378c6d5a41126dd1d6d6955/photonlib-java-examples/aimattarget/src/main/java/frc/robot/Robot.java | ||
gerth2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| :language: java | ||
| :lines: 41-98 | ||
| :lines: 77-117 | ||
| :linenos: | ||
| :lineno-start: 41 | ||
| :lineno-start: 77 | ||
|
|
||
| .. tab-item:: C++ (Header) | ||
|
|
||
| .. rli:: https://raw.githubusercontent.com/PhotonVision/photonvision/ebef19af3d926cf87292177c9a16d01b71219306/photonlib-cpp-examples/aimattarget/src/main/include/Robot.h | ||
| .. rli:: https://raw.githubusercontent.com/gerth2/photonvision/adb3098fbe0cdbc1a378c6d5a41126dd1d6d6955/photonlib-cpp-examples/aimattarget/src/main/include/Robot.h | ||
| :language: c++ | ||
| :lines: 27-53 | ||
| :lines: 25-60 | ||
| :linenos: | ||
| :lineno-start: 27 | ||
| :lineno-start: 25 | ||
|
|
||
| .. tab-item:: C++ (Source) | ||
|
|
||
| .. rli:: https://raw.githubusercontent.com/PhotonVision/photonvision/ebef19af3d926cf87292177c9a16d01b71219306/photonlib-cpp-examples/aimattarget/src/main/cpp/Robot.cpp | ||
| .. rli:: https://raw.githubusercontent.com/gerth2/photonvision/adb3098fbe0cdbc1a378c6d5a41126dd1d6d6955/photonlib-cpp-examples/aimattarget/src/main/cpp/Robot.cpp | ||
| :language: c++ | ||
| :lines: 25-52 | ||
| :lines: 56-96 | ||
| :linenos: | ||
| :lineno-start: 25 | ||
| :lineno-start: 56 | ||
|
|
||
| .. tab-item:: Python | ||
|
|
||
| .. rli:: https://raw.githubusercontent.com/gerth2/photonvision/adb3098fbe0cdbc1a378c6d5a41126dd1d6d6955/photonlib-python-examples/aimattarget/robot.py | ||
| :language: python | ||
| :lines: 46-70 | ||
| :linenos: | ||
| :lineno-start: 46 | ||
|
|
||
| ``` | ||
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
|---|---|---|
|
|
@@ -4,8 +4,6 @@ | |
| :maxdepth: 1 | ||
|
|
||
| aimingatatarget | ||
| gettinginrangeofthetarget | ||
| aimandrange | ||
| simaimandrange | ||
| simposeest | ||
| poseest | ||
| ``` | ||
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.
Uh oh!
There was an error while loading. Please reload this page.