-
Notifications
You must be signed in to change notification settings - Fork 0
Bump Autoalign #37
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
Dillpickle9756
wants to merge
6
commits into
main
Choose a base branch
from
feature/bump-autoalign
base: main
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
Bump Autoalign #37
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
613e220
syncing current changes.
Dillpickle9756 1428717
Merge branch 'main' into feature/bump-autoalign
Dillpickle9756 f96d55d
Create a bump align method
Dillpickle9756 0c88d20
Creating bumpAlign command
Dillpickle9756 3ee6f7a
Creating is close to bump method
Dillpickle9756 43f8aa3
Added trigger in robot.java
Dillpickle9756 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -605,6 +605,31 @@ public Command faceHub(DoubleSupplier xVel, DoubleSupplier yVel) { | |
| yVel); | ||
| } | ||
|
|
||
| public Command bumpAlign(DoubleSupplier xVel, DoubleSupplier yVel) { | ||
| return driveWithHeadingSnap( | ||
| () -> { | ||
| if(getPose().getRotation().getDegrees() <= 90 || getPose().getRotation().getDegrees() >= 270){ | ||
| return Rotation2d.kZero; | ||
| } else { | ||
| return Rotation2d.k180deg; | ||
| } | ||
| }, | ||
| xVel, | ||
| yVel); | ||
| } | ||
|
|
||
| public boolean isCloseToBump(){ | ||
| if( | ||
| ((Math.abs(getPose().getX() - 4.62) < 2) || (Math.abs(getPose().getX() - 11.91) < 2)) | ||
| && | ||
| ((getPose().getY() > 5.04 && getPose().getY() < 6.07) || (getPose().getY() > 2 && getPose().getY() < 3.01))) | ||
|
Comment on lines
+623
to
+625
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i'd recommend throwing these numbers for the coordinates (4.62, 11.91 etc) into FieldUtils.java as constants (so similar to the BLUE_HUB_POS that's already there) and then referencing them by name here to minimize the amount of "magic numbers" floating around in our code |
||
| { | ||
| return true; | ||
| } else { | ||
| return false; | ||
| } | ||
| } | ||
|
|
||
| public boolean isInAutoAimTolerance(Pose2d target) { | ||
| return isInTolerance( | ||
| target, AutoAlign.TRANSLATION_TOLERANCE_METERS, AutoAlign.ROTATION_TOLERANCE_RADIANS); | ||
|
|
||
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.
this is the right logic, although the while loop doesn't explicitly create a trigger object around this boolean value