Package frc.lib.util
Class LazySelectCommand<K>
java.lang.Object
edu.wpi.first.wpilibj2.command.Command
frc.lib.util.LazySelectCommand<K>
- All Implemented Interfaces:
Sendable
Similar to
SelectCommand but allows commands for all variants of an enum instead. Also
doesn't require all subsystems of all commands, only the selected command on run time.-
Nested Class Summary
Nested classes/interfaces inherited from class edu.wpi.first.wpilibj2.command.Command
Command.InterruptionBehavior -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidend(boolean interrupted) voidexecute()voidvoidinitSendable(SendableBuilder builder) booleanbooleanWhether the given command should run when the robot is disabled.Methods 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, isScheduled, onlyIf, onlyWhile, raceWith, repeatedly, schedule, setName, setSubsystem, unless, until, withDeadline, withInterruptBehavior, withName, withTimeout, withTimeout
-
Constructor Details
-
LazySelectCommand
Create new LazySelectCommand. Note that the length of enumValues and commandValues must be the same.- Throws:
IllegalArgumentException- when enumValues and commandValues have different lengths.
-
-
Method Details
-
initialize
public void initialize()- Overrides:
initializein classCommand
-
end
public void end(boolean interrupted) -
execute
public void execute() -
isFinished
public boolean isFinished()- Overrides:
isFinishedin classCommand
-
runsWhenDisabled
public boolean runsWhenDisabled()Whether the given command should run when the robot is disabled. Override to return true if the command should run when disabled.- Overrides:
runsWhenDisabledin classCommand- Returns:
- true. Otherwise, this proxy would cancel commands that do run when disabled.
-
initSendable
- Specified by:
initSendablein interfaceSendable- Overrides:
initSendablein classCommand
-