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 TypeMethodDescriptionvoid
end
(boolean interrupted) void
execute()
void
void
initSendable
(SendableBuilder builder) boolean
boolean
Whether 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:
initialize
in classCommand
-
end
public void end(boolean interrupted) -
execute
public void execute() -
isFinished
public boolean isFinished()- Overrides:
isFinished
in 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:
runsWhenDisabled
in classCommand
- Returns:
- true. Otherwise, this proxy would cancel commands that do run when disabled.
-
initSendable
- Specified by:
initSendable
in interfaceSendable
- Overrides:
initSendable
in classCommand
-