-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: made indexer probably interact better with other subsystems
- Loading branch information
Showing
9 changed files
with
119 additions
and
23 deletions.
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
25 changes: 25 additions & 0 deletions
25
src/main/java/org/team1540/robot2024/commands/indexer/PrepareIndexerForShooter.java
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,25 @@ | ||
package org.team1540.robot2024.commands.indexer; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import org.team1540.robot2024.subsystems.indexer.Indexer; | ||
|
||
public class PrepareIndexerForShooter extends Command { | ||
|
||
private final Indexer indexer; | ||
|
||
public PrepareIndexerForShooter(Indexer indexer) { | ||
this.indexer = indexer; | ||
addRequirements(indexer); | ||
} | ||
|
||
@Override | ||
public void initialize() { | ||
indexer.setFeederVelocity(1200); | ||
} | ||
|
||
@Override | ||
public boolean isFinished() { | ||
return indexer.isFeederAtSetpoint(); | ||
} | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/org/team1540/robot2024/commands/indexer/PrepareIndexerForTramp.java
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,26 @@ | ||
package org.team1540.robot2024.commands.indexer; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import org.team1540.robot2024.subsystems.indexer.Indexer; | ||
|
||
public class PrepareIndexerForTramp extends Command { | ||
|
||
private final Indexer indexer; | ||
|
||
// I'm not sure if the tramp should be done the same as the shooter here, but I think consistency wins? | ||
public PrepareIndexerForTramp(Indexer indexer) { | ||
this.indexer = indexer; | ||
addRequirements(indexer); | ||
} | ||
|
||
@Override | ||
public void initialize() { | ||
indexer.setFeederVelocity(-600); | ||
} | ||
|
||
@Override | ||
public boolean isFinished() { | ||
return indexer.isFeederAtSetpoint(); | ||
} | ||
|
||
} |
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
4 changes: 2 additions & 2 deletions
4
src/main/java/org/team1540/robot2024/commands/shooter/ShootSequence.java
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
26 changes: 26 additions & 0 deletions
26
src/main/java/org/team1540/robot2024/commands/tramp/StageTrampCommand.java
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,26 @@ | ||
package org.team1540.robot2024.commands.tramp; | ||
|
||
import edu.wpi.first.wpilibj2.command.Commands; | ||
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; | ||
import edu.wpi.first.wpilibj2.command.WaitCommand; | ||
import org.team1540.robot2024.commands.indexer.PrepareIndexerForTramp; | ||
import org.team1540.robot2024.subsystems.indexer.Indexer; | ||
import org.team1540.robot2024.subsystems.tramp.Tramp; | ||
|
||
public class StageTrampCommand extends SequentialCommandGroup { | ||
public StageTrampCommand(Tramp tramp, Indexer indexer) { | ||
addCommands( | ||
new PrepareIndexerForTramp(indexer), | ||
Commands.parallel( | ||
Commands.runOnce(() -> indexer.setIntakePercent(0.5), indexer), | ||
Commands.runOnce(() -> tramp.setPercent(0.5), tramp), | ||
Commands.waitUntil(tramp::isNoteStaged) | ||
), | ||
Commands.parallel( | ||
Commands.runOnce(indexer::stopAll), | ||
Commands.runOnce(tramp::stop, tramp) | ||
) | ||
|
||
); | ||
} | ||
} |
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