Class GameplayStateCommandFactory
GameplayState.
Each factory method produces a command group that sets the appropriate gameplay state on the GameplayStateSubsystem and then schedules
mechanism commands in parallel so the robot acts as a unified system. The factory delegates to individual subsystem command factories rather than
driving motors directly, keeping subsystem ownership intact.
-
Field Summary
Fields inherited from class frc.robot.shared.commands.AbstractSubsystemCommandFactory
subsystem -
Constructor Summary
ConstructorsConstructorDescriptionGameplayStateCommandFactory(GameplayStateSubsystem subsystem, ShooterSubsystemCommandFactory shooterCommandFactory, IndexerSubsystemCommandFactory indexerCommandFactory, FeederSubsystemCommandFactory feederCommandFactory, IntakeSubsystemCommandFactory intakeCommandFactory, HarvesterSubsystemCommandFactory harvesterCommandFactory, Supplier<Double> distanceToTargetMetersSupplier, Supplier<Boolean> turretReadySupplier) Creates a factory that composes gameplay state commands from individual subsystem command factories. -
Method Summary
Modifier and TypeMethodDescriptionedu.wpi.first.wpilibj2.command.CommandBuilds the EJECT state command group: reverses all ball-path mechanisms to expel Fuel.edu.wpi.first.wpilibj2.command.CommandBuilds the FIRE_READY state command group: spins up the shooter and stages Fuel in the indexer while the turret continues tracking via its default command.edu.wpi.first.wpilibj2.command.CommandBuilds the HARVEST_READY state command group: deploys the harvester arm and spins the intake and feeder to pull Fuel into the robot while the shooter idles.edu.wpi.first.wpilibj2.command.CommandBuilds the IDLE state command group: all subsystems return to their resting positions.edu.wpi.first.wpilibj2.command.CommandBuilds the TRAVEL state command group: stows the harvester and idles all other mechanisms for safe field traversal.edu.wpi.first.wpilibj2.command.CommandBuilds the TRENCH_TRAVEL state command group: deploys the harvester for low-profile clearance under field obstacles while idling all other mechanisms.edu.wpi.first.wpilibj2.command.CommandSets the idle command as the default behavior for the gameplay state subsystem.Methods inherited from class frc.robot.shared.commands.AbstractSubsystemCommandFactory
getSubsystem
-
Constructor Details
-
GameplayStateCommandFactory
public GameplayStateCommandFactory(GameplayStateSubsystem subsystem, ShooterSubsystemCommandFactory shooterCommandFactory, IndexerSubsystemCommandFactory indexerCommandFactory, FeederSubsystemCommandFactory feederCommandFactory, IntakeSubsystemCommandFactory intakeCommandFactory, HarvesterSubsystemCommandFactory harvesterCommandFactory, Supplier<Double> distanceToTargetMetersSupplier, Supplier<Boolean> turretReadySupplier) Creates a factory that composes gameplay state commands from individual subsystem command factories.- Parameters:
subsystem- gameplay state subsystem that tracks the current operating modeshooterCommandFactory- factory for shooter flywheel commandsindexerCommandFactory- factory for indexer roller commandsfeederCommandFactory- factory for feeder belt commandsintakeCommandFactory- factory for intake roller commandsharvesterCommandFactory- factory for harvester arm commandsdistanceToTargetMetersSupplier- supplier returning the distance from the robot to the active scoring target in metersturretReadySupplier- supplier returning true when the turret has settled on its target
-
-
Method Details
-
createIdleCommand
public edu.wpi.first.wpilibj2.command.Command createIdleCommand()Builds the IDLE state command group: all subsystems return to their resting positions.The shooter idles at its configured idle RPM, the indexer and feeder stop completely, the intake stops, and the harvester stows.
- Returns:
- parallel command group that idles all mechanisms
-
createHarvestReadyCommand
public edu.wpi.first.wpilibj2.command.Command createHarvestReadyCommand()Builds the HARVEST_READY state command group: deploys the harvester arm and spins the intake and feeder to pull Fuel into the robot while the shooter idles.- Returns:
- parallel command group that prepares the robot for Fuel collection
-
createFireReadyCommand
public edu.wpi.first.wpilibj2.command.Command createFireReadyCommand()Builds the FIRE_READY state command group: spins up the shooter and stages Fuel in the indexer while the turret continues tracking via its default command.Both the indexer and feeder wait until the shooter and turret report ready before activating. The indexer gates on readiness via
createFireWhenReadyCommand, and the feeder similarly waits before running its reverse-pulse-then-forward sequence. When the command ends or is interrupted (e.g., operator releases the fire trigger), all mechanisms transition back to IDLE so the indexer and feeder stop cleanly. The turret is not explicitly commanded here because it runs its default tracking command at all times.- Returns:
- parallel command group that prepares the robot to score
-
createEjectCommand
public edu.wpi.first.wpilibj2.command.Command createEjectCommand()Builds the EJECT state command group: reverses all ball-path mechanisms to expel Fuel.The shooter stops, and the indexer, feeder, and intake all run in reverse to push Fuel out of the robot. The harvester deploys so ejected Fuel can exit cleanly.
- Returns:
- parallel command group that ejects all Fuel from the robot
-
createTravelCommand
public edu.wpi.first.wpilibj2.command.Command createTravelCommand()Builds the TRAVEL state command group: stows the harvester and idles all other mechanisms for safe field traversal.This state is useful when driving across the field without actively collecting or scoring. The harvester moves to its stowed position so it stays inside the frame perimeter, while the shooter, indexer, feeder, and intake return to their idle behaviors.
- Returns:
- parallel command group that stows the harvester and idles all other mechanisms
-
createTrenchTravelCommand
public edu.wpi.first.wpilibj2.command.Command createTrenchTravelCommand()Builds the TRENCH_TRAVEL state command group: deploys the harvester for low-profile clearance under field obstacles while idling all other mechanisms.This state is identical to TRAVEL except the harvester is deployed instead of stowed, allowing the robot to pass under structures such as the trench run.
- Returns:
- parallel command group that deploys the harvester and idles all other mechanisms
-
setDefaultIdleCommand
public edu.wpi.first.wpilibj2.command.Command setDefaultIdleCommand()Sets the idle command as the default behavior for the gameplay state subsystem.- Returns:
- the idle command that was set as the default
-