-
Notifications
You must be signed in to change notification settings - Fork 2
PID Ronit #13
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
Draft
ShayanHasNo
wants to merge
5
commits into
main
Choose a base branch
from
distanceShootingPIDTask
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.
Draft
PID Ronit #13
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
393a1f3
Shooting Testing
rkris28 9e62d5e
regression line
ShayanHasNo 6ce40c4
fixed regression line, implemented shooting functions
ShayanHasNo ebe7206
Pushing Tasked Files - Not Fully Finished
Rshar2027 d90421b
Cleaning up code and fixing minor errors
Rshar2027 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 |
|---|---|---|
|
|
@@ -28,7 +28,7 @@ | |
| *.lai | ||
| *.la | ||
| *.a | ||
| *.lib | ||
| *.frc.robot.lib | ||
|
|
||
| # Executables | ||
| *.exe | ||
|
|
||
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 |
|---|---|---|
|
|
@@ -7,22 +7,42 @@ | |
| import frc.robot.subsystems.indexer.Indexer; | ||
| import frc.robot.subsystems.shooter.Shooter; | ||
| import frc.robot.subsystems.shooter.ShooterConstants; | ||
| import org.littletonrobotics.junction.AutoLogOutput; | ||
| import org.littletonrobotics.junction.Logger; | ||
|
|
||
|
|
||
| public class Orchestrator { | ||
| private final Indexer indexer; | ||
| private final Shooter shooter; | ||
| @AutoLogOutput | ||
| private double Distance = 300.0; | ||
| @AutoLogOutput private double shootingPower = 0.0; | ||
|
|
||
| public Orchestrator(Indexer indexer, Shooter shooter) { | ||
| this.indexer = indexer; | ||
| this.shooter = shooter; | ||
| } | ||
| public Command spinUpDistance(Double distance) { | ||
| Distance = distance; | ||
| double percent = (8.331 * Math.pow(10, -5) * Math.pow(distance, 2) + 0.0734 * distance + 15.709) / 100; | ||
| Logger.recordOutput("Shooter/Percent", percent); | ||
| return shooter.runPercent(percent); | ||
| } | ||
| public Command shootCycleDistance() { | ||
| return Commands.parallel( | ||
| spinUpDistance(420.0), | ||
| Commands.sequence( | ||
| intakeIfNeeded(), | ||
| Commands.waitSeconds(ShooterConstants.SPINUP_SECONDS), | ||
|
Contributor
Author
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. use the atSetpoint boolean and commands.wait method to wait until the flywheel is up to speed |
||
| indexer.indexIntoShooter()) | ||
| .repeatedly()); | ||
| } | ||
|
|
||
| public Command spinUp(BooleanSupplier fastMode) { | ||
| return Commands.either( | ||
| shooter.fullSpeed(), | ||
| shooter.speedUp(), | ||
| fastMode); | ||
| shooter.runPercent(0.8), | ||
| fastMode); | ||
| } | ||
|
|
||
| public Command intakeIfNeeded() { | ||
|
|
@@ -58,4 +78,4 @@ public Command reverseAll() { | |
| public Command stopAll() { | ||
| return Commands.parallel(shooter.stop(), indexer.stop()); | ||
| } | ||
| } | ||
| } | ||
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 |
|---|---|---|
|
|
@@ -2,15 +2,11 @@ | |
|
|
||
| public class ShooterConstants { | ||
|
|
||
| public static final double SPEED = 0.8; | ||
|
|
||
| public static final double TOLERANCE = 0.0; | ||
| public static final double ENCODER_POSITION_CONVERSION_FACTOR = 1.0; | ||
| public static final double ENCODER_VELOCITY_CONVERSION_FACTOR = 1.0; | ||
| public static final double REVERSE_SHOOTER_PERCENT = -0.5; | ||
|
|
||
| public static final int SHOOTER_MOTOR_ID = 8; | ||
| public static final double SPINUP_SECONDS = 0.6; | ||
|
Contributor
Author
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. this is unnecessary |
||
|
|
||
| public static final double ENCODER_POSITION_CONVERSION = 1.0; | ||
|
|
||
| public static final double ENCODER_VELOCITY_CONVERSION = 1.0; | ||
|
|
||
| public static final double SPINUP_SECONDS = 0.1; | ||
| } | ||
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
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.
dont use this, this is a deprecated function we are NOT going to use anymore. instead have rpm be passed in as an arguement