Package frc.robot.shared.commands
Class AbstractIdleVelocityCommand<TSubsystem extends AbstractVelocitySubsystem<?>>
java.lang.Object
edu.wpi.first.wpilibj2.command.Command
frc.robot.shared.commands.AbstractSubsystemCommand<TSubsystem>
frc.robot.shared.commands.AbstractIdleVelocityCommand<TSubsystem>
- Type Parameters:
TSubsystem- concrete velocity subsystem type
- All Implemented Interfaces:
edu.wpi.first.util.sendable.Sendable
- Direct Known Subclasses:
IdleFeederCommand,IdleIndexerCommand,IdleIntakeCommand,IdleShooterCommand
public class AbstractIdleVelocityCommand<TSubsystem extends AbstractVelocitySubsystem<?>>
extends AbstractSubsystemCommand<TSubsystem>
Default command that maintains the idle velocity configured for a velocity subsystem.
Set this as the default command so the mechanism keeps spinning at the idle RPM when no other command is running. The command never finishes on its own; it runs until interrupted by a higher-priority command (such as a spin-up for shooting). When interrupted, the motor is intentionally left running because the replacement command takes over motor control immediately. The WPILib command scheduler guarantees a default command is rescheduled within one cycle of interruption, so there is no gap where the motor would spin uncontrolled.
-
Nested Class Summary
Nested classes/interfaces inherited from class edu.wpi.first.wpilibj2.command.Command
edu.wpi.first.wpilibj2.command.Command.InterruptionBehavior -
Field Summary
Fields inherited from class frc.robot.shared.commands.AbstractSubsystemCommand
log, subsystem -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractIdleVelocityCommand(TSubsystem subsystem) Creates an idle command for the given velocity subsystem. -
Method Summary
Methods inherited from class frc.robot.shared.commands.AbstractSubsystemCommand
initializeMethods inherited from class edu.wpi.first.wpilibj2.command.Command
addRequirements, addRequirements, alongWith, andThen, andThen, asProxy, beforeStarting, beforeStarting, cancel, deadlineFor, deadlineWith, finallyDo, finallyDo, getInterruptionBehavior, getName, getRequirements, getSubsystem, handleInterrupt, hasRequirement, ignoringDisable, initSendable, isScheduled, onlyIf, onlyWhile, raceWith, repeatedly, runsWhenDisabled, schedule, setName, setSubsystem, unless, until, withDeadline, withInterruptBehavior, withName, withTimeout, withTimeout
-
Constructor Details
-
AbstractIdleVelocityCommand
Creates an idle command for the given velocity subsystem.- Parameters:
subsystem- subsystem instance to hold at idle RPM
-
-
Method Details
-
execute
public void execute()- Overrides:
executein classedu.wpi.first.wpilibj2.command.Command
-
end
public void end(boolean interrupted) - Overrides:
endin classedu.wpi.first.wpilibj2.command.Command
-
isFinished
public boolean isFinished()- Overrides:
isFinishedin classedu.wpi.first.wpilibj2.command.Command
-
onInitialize
protected void onInitialize()Description copied from class:AbstractSubsystemCommandOptional hook for subclasses to run logic during initialize after the start log.- Overrides:
onInitializein classAbstractSubsystemCommand<TSubsystem extends AbstractVelocitySubsystem<?>>
-