Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/frc3322/code-2024
Browse files Browse the repository at this point in the history
  • Loading branch information
IBuildRoboats committed Feb 19, 2024
2 parents 785c573 + 34b5fe0 commit 3a6f2fe
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 31 deletions.
2 changes: 2 additions & 0 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ public static final class ShooterConstants{
public static final double shooterBottomV = 0.00018;

public static final double shootingRMPAutoLine = 3000;

public static final double shooterRPMThreshold = 50;
}

public static final class IntakeConstants {
Expand Down
43 changes: 43 additions & 0 deletions src/main/java/frc/robot/commands/AutoCommmands.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package frc.robot.commands;

import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
import frc.robot.subsystems.DriveSubsystem;
import frc.robot.subsystems.Elevator;
import frc.robot.subsystems.Intake;
import frc.robot.subsystems.Shooter;
import frc.robot.subsystems.Transfer;

public class AutoCommmands {

private final DriveSubsystem robotDrive;
private final Elevator elevator;
private final Intake intake;
private final Shooter shooter;
private final Transfer transfer;
private final ComboCommands combo;

public AutoCommmands(DriveSubsystem robotDrive, Intake intake, Elevator elevator, Transfer transfer, Shooter shooter, ComboCommands combo) {
this.robotDrive = robotDrive;
this.elevator = elevator;
this.intake = intake;
this.transfer = transfer;
this.shooter = shooter;
this.combo = combo;
}

public Command shootOnStart() {
return new SequentialCommandGroup(
shooter.shooterAutoLineRevUpCommand(),
new StepCommand(transfer.shootCommand(), shooter::bothAtSetpointRPM, transfer)
);
}

// public Command autoIntake() {
// return new SequentialCommandGroup(
// combo.startShooterIntakeCommand()
// .until(transfer::shooterFull)
// .andThen(combo.stowCommandGroup())
// );
// }
}
26 changes: 0 additions & 26 deletions src/main/java/frc/robot/commands/Autos.java

This file was deleted.

6 changes: 3 additions & 3 deletions src/main/java/frc/robot/commands/StepCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

public class StepCommand extends Command {

private Runnable toRun;
private Command toRun;
private BooleanSupplier condition;

private boolean hasRun = false;
Expand All @@ -22,7 +22,7 @@ public class StepCommand extends Command {
* @param condition The condition to wait for.
* @param requirements The subsystems required by this command
*/
public StepCommand(Runnable toRun, BooleanSupplier condition, Subsystem... requirements) {
public StepCommand(Command toRun, BooleanSupplier condition, Subsystem... requirements) {
this.toRun = toRun;

addRequirements(requirements);
Expand All @@ -38,7 +38,7 @@ public void initialize() {
@Override
public void execute() {
if (condition.getAsBoolean()){
toRun.run();
toRun.schedule();
hasRun = true;
}
}
Expand Down
16 changes: 14 additions & 2 deletions src/main/java/frc/robot/subsystems/Shooter.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,28 @@ public double getBottomCombinedControllers() {
}

@Log
public double getTopWheelRPM(){
public double getTopWheelRPM() {
return shooterTopEncoder.getVelocity();
}

@Log
public double getBottomWheelRPM(){
public double getBottomWheelRPM() {
return shooterBottomEncoder.getVelocity();
}

@Log
public boolean topAtSetpointRPM() {
return Math.abs(getTopWheelRPM() - shooterTopSetpoint) < ShooterConstants.shooterRPMThreshold;
}

@Log
public boolean bottomAtSetpointRPM() {
return Math.abs(getBottomWheelRPM() - shooterBottomSetpoint) < ShooterConstants.shooterRPMThreshold;
}

@Log public boolean bothAtSetpointRPM() {
return topAtSetpointRPM() && bottomAtSetpointRPM();
}

/*◇─◇──◇─◇
✨Setters✨
Expand Down

0 comments on commit 3a6f2fe

Please sign in to comment.