-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/MEFThunders-7035/MEF-Thun…
- Loading branch information
Showing
30 changed files
with
915 additions
and
88 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
14 changes: 9 additions & 5 deletions
14
src/main/java/frc/robot/commands/BasicRunShooterCommand.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 |
---|---|---|
@@ -1,21 +1,25 @@ | ||
package frc.robot.commands; | ||
|
||
import edu.wpi.first.wpilibj2.command.ParallelRaceGroup; | ||
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; | ||
import frc.robot.Constants.ShooterConstants; | ||
import frc.robot.commands.led_commands.LEDLoadingWaitCommand; | ||
import frc.robot.subsystems.ShooterSubsystem; | ||
|
||
public class BasicRunShooterCommand extends SequentialCommandGroup { | ||
BasicRunShooterCommand(ShooterSubsystem shooterSubsystem) { | ||
public BasicRunShooterCommand(ShooterSubsystem shooterSubsystem) { | ||
super( | ||
shooterSubsystem.run( | ||
() -> shooterSubsystem.setShooterSpeed(ShooterConstants.kShooterSpeed))); | ||
} | ||
|
||
BasicRunShooterCommand(ShooterSubsystem shooterSubsystem, double untilTimeSeconds) { | ||
public BasicRunShooterCommand(ShooterSubsystem shooterSubsystem, double untilTimeSeconds) { | ||
super( | ||
shooterSubsystem | ||
.run(() -> shooterSubsystem.setShooterSpeed(ShooterConstants.kShooterSpeed)) | ||
.raceWith(new LEDLoadingWaitCommand(untilTimeSeconds))); | ||
new ParallelRaceGroup( | ||
new BasicRunShooterCommand(shooterSubsystem), // Run the shooter | ||
new LEDLoadingWaitCommand(untilTimeSeconds)), | ||
shooterSubsystem.runOnce( | ||
() -> shooterSubsystem.setShooterSpeed(0) // Stop the shooter after the wait | ||
)); | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
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
35 changes: 35 additions & 0 deletions
35
src/main/java/frc/robot/commands/util_commands/RepeatForCommand.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,35 @@ | ||
package frc.robot.commands.util_commands; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import edu.wpi.first.wpilibj2.command.RepeatCommand; | ||
|
||
public class RepeatForCommand extends RepeatCommand { | ||
private double count; | ||
private Command command; | ||
|
||
/** | ||
* Repeats a command for a specified number of times | ||
* | ||
* @param command The command to repeat | ||
* @param count The number of times to repeat the command | ||
*/ | ||
public RepeatForCommand(Command command, int count) { | ||
super(command); | ||
this.command = command; | ||
this.count = count; | ||
} | ||
|
||
@Override | ||
public void execute() { | ||
// only decrement the count if the command has finished | ||
if (command.isFinished()) { | ||
count--; | ||
} | ||
super.execute(); | ||
} | ||
|
||
@Override | ||
public boolean isFinished() { | ||
return count <= 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
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.