Skip to content
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 separate methods for amp and speaker feed speeds #52

Merged
merged 1 commit into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 27 additions & 27 deletions src/main/java/frc/robot/Auton.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public AutonInput periodic(Launcher launcher, Indexer indexer, Drivetrain drivet
else {
launcher.speakerLaunch();
if (m_loopCount > RobotMap.LAUNCH_SPIN_UP_COUNT){
indexer.feedNote();
indexer.speakerFeedNote();
System.out.println("Step feeding: " + m_step + " loopcount:" + m_loopCount + " - " + m_loopCount);
}
else {
Expand Down Expand Up @@ -248,7 +248,7 @@ public AutonInput periodic(Launcher launcher, Indexer indexer, Drivetrain drivet
else {
launcher.speakerLaunch();
if (m_loopCount > RobotMap.LAUNCH_SPIN_UP_COUNT){
indexer.feedNote();
indexer.speakerFeedNote();
}
else {
indexer.stop();
Expand Down Expand Up @@ -368,7 +368,7 @@ public AutonInput periodic(Launcher launcher, Indexer indexer, Drivetrain drivet
else {
launcher.speakerLaunch();
if (m_loopCount > RobotMap.LAUNCH_SPIN_UP_COUNT){
indexer.feedNote();
indexer.speakerFeedNote();
}
else {
indexer.stop();
Expand Down Expand Up @@ -488,7 +488,7 @@ public AutonInput periodic(Launcher launcher, Indexer indexer, Drivetrain drivet
else {
launcher.speakerLaunch();
if (m_loopCount > RobotMap.LAUNCH_SPIN_UP_COUNT){
indexer.feedNote();
indexer.speakerFeedNote();
}
else {
indexer.stop();
Expand Down Expand Up @@ -628,7 +628,7 @@ public AutonInput periodic(Launcher launcher, Indexer indexer, Drivetrain drivet
else {
launcher.speakerLaunch();
if (m_loopCount > RobotMap.LAUNCH_SPIN_UP_COUNT){
indexer.feedNote();
indexer.speakerFeedNote();
}
else {
indexer.stop();
Expand Down Expand Up @@ -698,7 +698,7 @@ public AutonInput periodic(Launcher launcher, Indexer indexer, Drivetrain drivet
else {
launcher.speakerLaunch();
if (m_loopCount > RobotMap.LAUNCH_SPIN_UP_COUNT){
indexer.feedNote();
indexer.speakerFeedNote();
}
else {
indexer.stop();
Expand Down Expand Up @@ -828,7 +828,7 @@ public AutonInput periodic(Launcher launcher, Indexer indexer, Drivetrain drivet
else {
launcher.speakerLaunch();
if (m_loopCount > RobotMap.LAUNCH_SPIN_UP_COUNT){
indexer.feedNote();
indexer.speakerFeedNote();
}
else {
indexer.stop();
Expand Down Expand Up @@ -896,7 +896,7 @@ public AutonInput periodic(Launcher launcher, Indexer indexer, Drivetrain drivet
else {
launcher.speakerLaunch();
if (m_loopCount > RobotMap.LAUNCH_SPIN_UP_COUNT){
indexer.feedNote();
indexer.speakerFeedNote();
}
else {
indexer.stop();
Expand Down Expand Up @@ -1021,7 +1021,7 @@ public AutonInput periodic(Launcher launcher, Indexer indexer, Drivetrain drivet
else {
launcher.speakerLaunch();
if (m_loopCount > RobotMap.LAUNCH_SPIN_UP_COUNT){
indexer.feedNote();
indexer.speakerFeedNote();
}
else {
indexer.stop();
Expand Down Expand Up @@ -1135,7 +1135,7 @@ public AutonInput periodic(Launcher launcher, Indexer indexer, Drivetrain drivet
else {
launcher.speakerLaunch();
if (m_loopCount > RobotMap.LAUNCH_SPIN_UP_COUNT){
indexer.feedNote();
indexer.speakerFeedNote();
System.out.println("Step feeding: " + m_step + " loopcount:" + m_loopCount + " - " + m_loopCount);
}
else {
Expand Down Expand Up @@ -1198,7 +1198,7 @@ public AutonInput periodic(Launcher launcher, Indexer indexer, Drivetrain drivet
else {
launcher.speakerLaunch();
if (m_loopCount > RobotMap.LAUNCH_SPIN_UP_COUNT){
indexer.feedNote();
indexer.speakerFeedNote();
}
else {
indexer.stop();
Expand Down Expand Up @@ -1264,7 +1264,7 @@ public AutonInput periodic(Launcher launcher, Indexer indexer, Drivetrain drivet
else {
launcher.speakerLaunch();
if (m_loopCount > RobotMap.LAUNCH_SPIN_UP_COUNT){
indexer.feedNote();
indexer.speakerFeedNote();
}
else {
indexer.stop();
Expand Down Expand Up @@ -1375,7 +1375,7 @@ public AutonInput periodic(Launcher launcher, Indexer indexer, Drivetrain drivet
else {
launcher.speakerLaunch();
if (m_loopCount > RobotMap.LAUNCH_SPIN_UP_COUNT){
indexer.feedNote();
indexer.speakerFeedNote();
}
else {
indexer.stop();
Expand Down Expand Up @@ -1444,7 +1444,7 @@ public AutonInput periodic(Launcher launcher, Indexer indexer, Drivetrain drivet
else {
launcher.speakerLaunch();
if (m_loopCount > RobotMap.LAUNCH_SPIN_UP_COUNT){
indexer.feedNote();
indexer.speakerFeedNote();
}
else {
indexer.stop();
Expand Down Expand Up @@ -1566,7 +1566,7 @@ public AutonInput periodic(Launcher launcher, Indexer indexer, Drivetrain drivet
else {
launcher.speakerLaunch();
if (m_loopCount > RobotMap.LAUNCH_SPIN_UP_COUNT){
indexer.feedNote();
indexer.speakerFeedNote();
}
else {
indexer.stop();
Expand Down Expand Up @@ -1885,7 +1885,7 @@ public AutonInput periodic(Launcher launcher, Indexer indexer, Drivetrain drivet
else {
launcher.speakerLaunch();
if (m_loopCount > RobotMap.LAUNCH_SPIN_UP_COUNT){
indexer.feedNote();
indexer.speakerFeedNote();
System.out.println("Step feeding: " + m_step + " loopcount:" + m_loopCount + " - " + m_loopCount);
}
else {
Expand Down Expand Up @@ -1948,7 +1948,7 @@ public AutonInput periodic(Launcher launcher, Indexer indexer, Drivetrain drivet
else {
launcher.speakerLaunch();
if (m_loopCount > RobotMap.LAUNCH_SPIN_UP_COUNT){
indexer.feedNote();
indexer.speakerFeedNote();
}
else {
indexer.stop();
Expand Down Expand Up @@ -2070,7 +2070,7 @@ public AutonInput periodic(Launcher launcher, Indexer indexer, Drivetrain drivet
else {
launcher.speakerLaunch();
if (m_loopCount > RobotMap.LAUNCH_SPIN_UP_COUNT){
indexer.feedNote();
indexer.speakerFeedNote();
}
else {
indexer.stop();
Expand Down Expand Up @@ -2124,7 +2124,7 @@ public AutonInput periodic(Launcher launcher, Indexer indexer, Drivetrain drivet
else {
launcher.speakerLaunch();
if (m_loopCount > RobotMap.LAUNCH_SPIN_UP_COUNT){
indexer.feedNote();
indexer.speakerFeedNote();
System.out.println("Step feeding: " + m_step + " loopcount:" + m_loopCount + " - " + m_loopCount);
}
else {
Expand Down Expand Up @@ -2187,7 +2187,7 @@ public AutonInput periodic(Launcher launcher, Indexer indexer, Drivetrain drivet
else {
launcher.speakerLaunch();
if (m_loopCount > RobotMap.LAUNCH_SPIN_UP_COUNT){
indexer.feedNote();
indexer.speakerFeedNote();
}
else {
indexer.stop();
Expand Down Expand Up @@ -2309,7 +2309,7 @@ public AutonInput periodic(Launcher launcher, Indexer indexer, Drivetrain drivet
else {
launcher.speakerLaunch();
if (m_loopCount > RobotMap.LAUNCH_SPIN_UP_COUNT){
indexer.feedNote();
indexer.speakerFeedNote();
}
else {
indexer.stop();
Expand Down Expand Up @@ -2363,7 +2363,7 @@ public AutonInput periodic(Launcher launcher, Indexer indexer, Drivetrain drivet
else {
launcher.speakerLaunch();
if (m_loopCount > RobotMap.LAUNCH_SPIN_UP_COUNT){
indexer.feedNote();
indexer.speakerFeedNote();
System.out.println("Step feeding: " + m_step + " loopcount:" + m_loopCount + " - " + m_loopCount);
}
else {
Expand Down Expand Up @@ -2426,7 +2426,7 @@ public AutonInput periodic(Launcher launcher, Indexer indexer, Drivetrain drivet
else {
launcher.speakerLaunch();
if (m_loopCount > RobotMap.LAUNCH_SPIN_UP_COUNT){
indexer.feedNote();
indexer.speakerFeedNote();
}
else {
indexer.stop();
Expand Down Expand Up @@ -2548,7 +2548,7 @@ public AutonInput periodic(Launcher launcher, Indexer indexer, Drivetrain drivet
else {
launcher.speakerLaunch();
if (m_loopCount > RobotMap.LAUNCH_SPIN_UP_COUNT){
indexer.feedNote();
indexer.speakerFeedNote();
}
else {
indexer.stop();
Expand Down Expand Up @@ -2645,7 +2645,7 @@ public AutonInput periodic(Launcher launcher, Indexer indexer, Drivetrain drivet
else {
launcher.speakerLaunch();
if (m_loopCount > RobotMap.LAUNCH_SPIN_UP_COUNT){
indexer.feedNote();
indexer.speakerFeedNote();
System.out.println("Step feeding: " + m_step + " loopcount:" + m_loopCount + " - " + m_loopCount);
}
else {
Expand Down Expand Up @@ -2708,7 +2708,7 @@ public AutonInput periodic(Launcher launcher, Indexer indexer, Drivetrain drivet
else {
launcher.speakerLaunch();
if (m_loopCount > RobotMap.LAUNCH_SPIN_UP_COUNT){
indexer.feedNote();
indexer.speakerFeedNote();
}
else {
indexer.stop();
Expand Down Expand Up @@ -2830,7 +2830,7 @@ public AutonInput periodic(Launcher launcher, Indexer indexer, Drivetrain drivet
else {
launcher.speakerLaunch();
if (m_loopCount > RobotMap.LAUNCH_SPIN_UP_COUNT){
indexer.feedNote();
indexer.speakerFeedNote();
}
else {
indexer.stop();
Expand Down
13 changes: 10 additions & 3 deletions src/main/java/frc/robot/Indexer.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,17 @@ public boolean loadNote() {
}

/**
* Helper method used to feed the note the launcher. Feed speed is 1.0.
* Helper method used to feed the note the launcher at speaker speeds. Feed speed is 1.0.
*/
public void feedNote() {
setIndexSpeed(RobotMap.IndexerConstants.FEED_SPEED);
public void speakerFeedNote() {
setIndexSpeed(RobotMap.IndexerConstants.SPEAKER_FEED_SPEED);
}

/**
* Helper method used to feed the note the launcher at amp speeds. Feed speed is 0.8.
*/
public void ampFeedNote() {
setIndexSpeed(RobotMap.IndexerConstants.AMP_FEED_SPEED);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -257,15 +257,15 @@ else if (lockClimbButton) {
// If we want to launch to the amp, set the launcher to amp speed and feed a note from the indexer.
if (ampLauncherOn) {
m_launcher.ampLaunch();
m_indexer.feedNote();
m_indexer.ampFeedNote();
}
// If we want to spin the launcher up to speed, set the launcher to speaker speed.
// Then when we want to launch, feed a note from the indexer.
else if (spinningUp) {
m_launcher.speakerLaunch();

if (speakerLauncherOn) {
m_indexer.feedNote();
m_indexer.speakerFeedNote();
}
else {
m_indexer.stop();
Expand All @@ -284,7 +284,7 @@ else if (spinningUp) {
// set the launcher to amp speed, feed a note from the the indexer, set the intake speed to 0, and set currentlyLaunching to true.
if (ampLauncherOn) {
m_launcher.ampLaunch();
m_indexer.feedNote();
m_indexer.ampFeedNote();
m_intake.stop();
m_currentlyLaunching = true;
}
Expand All @@ -295,7 +295,7 @@ else if (spinningUp) {
m_launcher.speakerLaunch();

if (speakerLauncherOn) {
m_indexer.feedNote();
m_indexer.speakerFeedNote();
}
else {
m_indexer.stop();
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/frc/robot/RobotMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,14 @@ public static class IndexerConstants {
public static final double LOAD_SPEED = 0.5;

/**
* Speed set to the index motor for feeding note into launcher.
* Speed set to the index motor for feeding note into launcher at speaker speeds.
*/
public static final double FEED_SPEED = 1.0;
public static final double SPEAKER_FEED_SPEED = 1.0;

/**
* Speed set to the index motor for feeding note into launcher at amp speeds.
*/
public static final double AMP_FEED_SPEED = 0.8;
}

/**
Expand Down