Skip to content

Commit

Permalink
Add passing shot
Browse files Browse the repository at this point in the history
  • Loading branch information
superpenguin612 committed Apr 13, 2024
1 parent c21c083 commit 293e171
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 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 @@ -237,6 +237,7 @@ public static final class Shooter {
public static final int CURRENT_LIMIT = 70;

public static final double IDLE_RPS = 35;
public static final double PASSING_RPS = 50;
public static final double SUBWOOFER_RPS = 55;
public static final double PODIUM_RPS = 84;

Expand Down Expand Up @@ -299,6 +300,7 @@ public static enum ShooterTiltPosition {
INTAKE(0.55 + 0.035),
CLIMB(1.176781),
SUBWOOFER(1.01572),
PASS(1.00),
PODIUM(0.651760);

public final double value;
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/frc/robot/Controls.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ public static void configureDriverControls(int port, Drivetrain drivetrain, Inta
RobotCommands.shootOnTheMoveCommand(drivetrain, intake, shooter, shooterTilt),
new Trigger(GlobalStates.SUBWOOFER_ONLY::enabled).or(GlobalStates.PODIUM_ONLY::enabled)));

joystick.flipTriggerIn().and(joystick.triggerSoftPress()).whileTrue(
RobotCommands.targetPassCommand(drivetrain, shooter, shooterTilt));
joystick.flipTriggerIn().and(joystick.triggerHardPress()).whileTrue(intake.runRollersCommand());

joystick.topRightHatUp()
.onTrue(GlobalStates.PODIUM_ONLY.enableCommand().andThen(GlobalStates.SUBWOOFER_ONLY.disableCommand()));
joystick.topRightHatDown()
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/frc/robot/RobotCommands.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package frc.robot;

import static frc.robot.Constants.Shooter.PASSING_RPS;
import static frc.robot.Constants.Shooter.PODIUM_RPS;
import static frc.robot.Constants.Shooter.SUBWOOFER_RPS;

import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.DriverStation.Alliance;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.Commands;
import edu.wpi.first.wpilibj2.command.ScheduleCommand;
Expand Down Expand Up @@ -89,6 +92,16 @@ public static Command targetSpeakerPodiumCommand(Drivetrain drivetrain, Shooter
.withName("RobotCommands.targetSpeakerSubwoofer");
}

public static Command targetPassCommand(Drivetrain drivetrain, Shooter shooter,
ShooterTilt shooterTilt) {
return Commands.parallel(
drivetrain.controlledRotateCommand(
() -> DriverStation.getAlliance().orElse(Alliance.Blue) == Alliance.Blue ? 2.5 : -2.5),
shooterTilt.moveToPositionCommand(() -> ShooterTiltPosition.PASS).asProxy(),
shooter.spinAtVelocityCommand(() -> PASSING_RPS).asProxy())
.withName("RobotCommands.targetPass");
}

public static Command shootCommand(Drivetrain drivetrain, Intake intake, Shooter shooter, ShooterTilt shooterTilt) {
return Commands.deadline(
Commands.waitUntil(() -> shooter.atGoal() && shooterTilt.atGoal())
Expand Down

0 comments on commit 293e171

Please sign in to comment.