-
Notifications
You must be signed in to change notification settings - Fork 0
Limelight #110
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
alexander-mcdowell
wants to merge
14
commits into
dev
Choose a base branch
from
limelight
base: dev
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
Limelight #110
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
b4b4578
Robot code that we know works (#104)
kevinzwang ba673dd
Create branch and add basic limelight functionality
alexander-mcdowell 37e3dbf
Make it so that drive assist occurs only when bounding box is seen
alexander-mcdowell 98c1bba
Create AllignAssist Command (INCOMPLETE)
DriverStationComputer 479eaf7
Create Drive command (combines limelight drive and teleop drive)
8dc4594
Correct typo "Allign" to "Align"
c014588
Fix dean's comments and fix toggle limelight btn
alexander-mcdowell 5ae706b
Fixed NetworkTable data and area-based dist calculation
Akalay27 a308866
fixed ta
Akalay27 821e31a
calibrated steeringAssist and autoTarget works
DriverStationComputer 6a240e8
Lex's distance algorithm using linear algebra
alexander-mcdowell e92ddd8
2020 Build Season Autonomous Prototyping
alexander-mcdowell da45242
Auto align testing changes
DeepBlueRobots 29782d4
removed debug print
CoolSpy3 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 |
|---|---|---|
|
|
@@ -24,37 +24,46 @@ public enum Mode { | |
| There are more values we could be using. Check the documentation. | ||
| */ | ||
| private double tv, tx, ty, ta; | ||
| private double prev_tx = 1.0; | ||
|
|
||
| // Adjusts the distance between a vision target and the robot. Uses basic PID with the ty value from the network table. | ||
| public double distanceAssist() { | ||
| tv = NetworkTableInstance.getDefault().getTable("limelight").getEntry("tv").getDouble(0.0); | ||
| ta = NetworkTableInstance.getDefault().getTable("limelight").getEntry("ta").getDouble(0.0); | ||
| SmartDashboard.putNumber("Crosshair Vertical Offset", ty); | ||
| double adjustment = 0.0; | ||
| double area_threshold = 10; // TODO: Set the desired area ratio. 0 to 100. | ||
| double Kp = 0.2; // TODO: Set PID K value. | ||
| double area_threshold = 1.75; // TODO: Set the desired area ratio. 0 to 100. | ||
| double Kp = 0.225; // TODO: Set PID K value. | ||
|
|
||
| if (tv == 1.0) { | ||
| adjustment = (area_threshold-ta)*Kp; | ||
| adjustment = (area_threshold - ta) * Kp; | ||
| } | ||
| adjustment = Math.signum(adjustment) * Math.min(Math.abs(adjustment), 0.5); | ||
| return adjustment; | ||
| } | ||
|
|
||
| // Adjusts the angle facing a vision target. Uses basic PID with the tx value from the network table. | ||
| public double steeringAssist() { | ||
| tv = NetworkTableInstance.getDefault().getTable("limelight").getEntry("tv").getDouble(0.0); | ||
| tx = -NetworkTableInstance.getDefault().getTable("limelight").getEntry("tx").getDouble(0.0); | ||
| SmartDashboard.putBoolean("Found Vision Target", tv == 1.0); | ||
| tx = NetworkTableInstance.getDefault().getTable("limelight").getEntry("tx").getDouble(0.0); | ||
| ta = NetworkTableInstance.getDefault().getTable("limelight").getEntry("ta").getDouble(0.0); | ||
| SmartDashboard.putNumber("Crosshair Horizontal Offset", tx); | ||
| SmartDashboard.putNumber("Found Vision Target", tv); | ||
| SmartDashboard.putNumber("Prev_tx", prev_tx); | ||
| double adjustment = 0.0; | ||
| double steering_factor = 0.25; | ||
| double Kp = 0.2; // TODO: Set PID K value. | ||
| double Kp = 0.025; // TODO: Set PID K value. | ||
|
|
||
| if (tv == 1.0) { | ||
| adjustment += Kp * tx; | ||
| if (ta > 0.02) { | ||
| adjustment += Kp * tx; | ||
| prev_tx = tx; | ||
| } | ||
| } else { | ||
| adjustment += steering_factor; | ||
| adjustment += Math.signum(prev_tx) * steering_factor; | ||
|
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. Same comment regarding += vs =. |
||
| } | ||
| adjustment = Math.signum(adjustment) * Math.min(Math.abs(adjustment), 0.5); | ||
| SmartDashboard.putNumber("Adjustment", adjustment); | ||
| return adjustment; | ||
| } | ||
|
|
||
|
|
||
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.
Using += instead of = here seems unnecessarily confusing. Am I missing something?