Class ShooterSubsystemCommandFactory
java.lang.Object
frc.robot.shared.commands.AbstractSubsystemCommandFactory<TSubsystem>
frc.robot.shared.commands.AbstractVelocityCommandFactory<ShooterSubsystem>
frc.robot.subsystems.shooter.commands.ShooterSubsystemCommandFactory
public class ShooterSubsystemCommandFactory
extends AbstractVelocityCommandFactory<ShooterSubsystem>
Generates commands that operate on the shooter subsystem so RobotContainer can stay focused on wiring.
-
Field Summary
Fields inherited from class frc.robot.shared.commands.AbstractSubsystemCommandFactory
subsystem -
Constructor Summary
ConstructorsConstructorDescriptionShooterSubsystemCommandFactory(ShooterSubsystem subsystem) Creates a factory for commands that share the given shooter subsystem instance. -
Method Summary
Modifier and TypeMethodDescriptionedu.wpi.first.wpilibj2.command.CommandBuilds a command that boosts the shooter RPM by the configured adjustment amount while held.edu.wpi.first.wpilibj2.command.CommandBuilds a command that cuts the shooter RPM by the configured adjustment amount while held.edu.wpi.first.wpilibj2.command.CommandcreateDistanceBasedSpinCommand(Supplier<Double> distanceMetersSupplier) Builds a command that continuously computes flywheel RPM from the robot's distance to a target.Builds an idle command that holds the flywheel at the configured idle RPM.Methods inherited from class frc.robot.shared.commands.AbstractVelocityCommandFactory
createContinuousVelocityCommand, createStopCommand, createSysIdDynamicCommand, createSysIdDynamicCommand, createSysIdDynamicCommandWithDefaultTimeout, createSysIdFullSweepCommand, createSysIdFullSweepCommand, createSysIdQuasistaticCommand, createSysIdQuasistaticCommand, createSysIdQuasistaticCommandWithDefaultTimeout, setDefaultIdleCommandMethods inherited from class frc.robot.shared.commands.AbstractSubsystemCommandFactory
getSubsystem
-
Constructor Details
-
ShooterSubsystemCommandFactory
Creates a factory for commands that share the given shooter subsystem instance.- Parameters:
subsystem- shooter subsystem instance that commands created by this factory will control
-
-
Method Details
-
createIdleCommand
Builds an idle command that holds the flywheel at the configured idle RPM.- Specified by:
createIdleCommandin classAbstractVelocityCommandFactory<ShooterSubsystem>- Returns:
- command that idles the shooter flywheel
-
createDistanceBasedSpinCommand
public edu.wpi.first.wpilibj2.command.Command createDistanceBasedSpinCommand(Supplier<Double> distanceMetersSupplier) Builds a command that continuously computes flywheel RPM from the robot's distance to a target.Each cycle, the command reads the current distance from the supplier, converts it to an RPM via the subsystem's interpolation table, and seeks that velocity. Use this as a default command or bind it to a button so the shooter automatically adjusts speed as the robot moves.
- Parameters:
distanceMetersSupplier- supplier returning the distance from the robot to the active target in meters- Returns:
- command that continuously tracks distance-based RPM until interrupted
-
createBoostRpmCommand
public edu.wpi.first.wpilibj2.command.Command createBoostRpmCommand()Builds a command that boosts the shooter RPM by the configured adjustment amount while held.The command does not require the shooter subsystem so it can run concurrently with an active shooting command. When the command ends (trigger released), the offset resets to zero.
- Returns:
- command that applies a positive RPM offset while active
-
createCutRpmCommand
public edu.wpi.first.wpilibj2.command.Command createCutRpmCommand()Builds a command that cuts the shooter RPM by the configured adjustment amount while held.The command does not require the shooter subsystem so it can run concurrently with an active shooting command. When the command ends (trigger released), the offset resets to zero.
- Returns:
- command that applies a negative RPM offset while active
-