-
Notifications
You must be signed in to change notification settings - Fork 0
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
Added Passer! #131
Merged
Merged
Added Passer! #131
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
f4c50cc
Added Passer!
Griffin9881 fadaaae
fixed 2 of the things wes wanted
Griffin9881 104827c
fixed problem with shoot passer
Griffin9881 ad314a5
swapper ports
Griffin9881 4c3d79e
added code for up on dpad to move elevator to passer
Griffin9881 a5b801a
Merge remote-tracking branch 'origin/main' into 130-make-passer
reediculous456 5023409
var naming changes
reediculous456 84e4b70
make passer command sequence use passer motor
reediculous456 10a277b
storage motor needs inverted
reediculous456 38c5a21
fix elevator lock on passer setpoint
reediculous456 bcfa643
removed unnecessary swith
reediculous456 31b81d3
passer needs inverted
reediculous456 3c609d4
passer is spark flex
reediculous456 574f83e
naming
reediculous456 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 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 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 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 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 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 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,54 @@ | ||
package frc.robot.commands; | ||
|
||
import edu.wpi.first.wpilibj.Timer; | ||
import edu.wpi.first.wpilibj2.command.Command; | ||
import frc.robot.subsystems.Passer; | ||
import frc.robot.subsystems.Scoring; | ||
import frc.robot.subsystems.Storage; | ||
|
||
public class ShootPasserCommand extends Command { | ||
private Scoring scoring = Scoring.getInstance(); | ||
private Storage storage = Storage.getInstance(); | ||
private Passer passer = Passer.getInstance(); | ||
private Timer timer = new Timer(); | ||
private double secondsToScore = 0; | ||
|
||
public ShootPasserCommand(double secondsToScore) { | ||
this.addRequirements(scoring); | ||
this.secondsToScore = secondsToScore; | ||
} | ||
|
||
public ShootPasserCommand() { | ||
this.addRequirements(scoring); | ||
} | ||
|
||
@Override | ||
public void initialize() { | ||
timer.start(); | ||
} | ||
|
||
@Override | ||
public void execute() { | ||
scoring.feedForPasser(); | ||
passer.shoot(); | ||
if (!storage.noteExitingStorage()) { | ||
storage.stopStorage(); | ||
} else { | ||
storage.runStorage(); | ||
} | ||
} | ||
|
||
@Override | ||
public boolean isFinished() { | ||
return this.secondsToScore != 0 ? timer.get() > this.secondsToScore : false; | ||
} | ||
|
||
@Override | ||
public void end(boolean interrupted) { | ||
scoring.stop(); | ||
storage.stopStorage(); | ||
passer.stop(); | ||
timer.stop(); | ||
timer.reset(); | ||
} | ||
} |
This file contains 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,7 @@ | ||
package frc.robot.constants; | ||
|
||
public class PasserConstants { | ||
public static final int passerMotorPort = 11; | ||
|
||
public static final double shooterSpeed = 1.0; | ||
} |
This file contains 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 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 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 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,61 @@ | ||
package frc.robot.subsystems; | ||
|
||
import com.revrobotics.CANSparkBase.IdleMode; | ||
import com.revrobotics.CANSparkLowLevel.MotorType; | ||
import com.revrobotics.CANSparkFlex; | ||
import com.revrobotics.RelativeEncoder; | ||
|
||
import edu.wpi.first.wpilibj2.command.SubsystemBase; | ||
import frc.robot.constants.NeoMotorConstants; | ||
import frc.robot.constants.PasserConstants; | ||
|
||
public class Passer extends SubsystemBase { | ||
private final CANSparkFlex passerMotor = new CANSparkFlex(PasserConstants.passerMotorPort, MotorType.kBrushless); | ||
private final RelativeEncoder passerEncoder = passerMotor.getEncoder(); | ||
|
||
private static Passer instance; | ||
|
||
/** | ||
* Creates an instance of the Passer subsystem if it does not already exist. | ||
* | ||
* @return An instance of the Passer subsystem. | ||
*/ | ||
public static Passer getInstance() { | ||
if (instance == null) { | ||
instance = new Passer(); | ||
} | ||
return instance; | ||
} | ||
|
||
private Passer() { | ||
passerMotor.restoreFactoryDefaults(); | ||
|
||
passerMotor.setIdleMode(IdleMode.kBrake); | ||
passerMotor.setSmartCurrentLimit(NeoMotorConstants.kMaxVortexCurrent); | ||
passerMotor.setInverted(true); | ||
|
||
passerMotor.burnFlash(); | ||
passerEncoder.setPosition(0); | ||
} | ||
|
||
/** | ||
* Get the encoder value of the passer encoder | ||
*/ | ||
public double getPosition() { | ||
return passerEncoder.getPosition(); | ||
} | ||
|
||
/** | ||
* Runs the passer at a constant speed | ||
*/ | ||
public void shoot() { | ||
passerMotor.set(PasserConstants.shooterSpeed); | ||
} | ||
|
||
/** | ||
* Stops the passer | ||
*/ | ||
public void stop() { | ||
passerMotor.stopMotor(); | ||
} | ||
} |
This file contains 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 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 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.
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.
Probably should be coast like shooter
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.
isn't shooter brake? or is that a different motor than the roller motor?
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.
Maybe I’m wrong but I thought it was in coast. If not this is fine