public class InstantCommand extends Command
Subclassing InstantCommand
is shorthand for returning true from
isFinished
.
Constructor and Description |
---|
InstantCommand() |
InstantCommand(String name)
Creates a new
InstantCommand with the given name. |
InstantCommand(String name,
Subsystem subsystem)
Creates a new
InstantCommand with the given name and requirement. |
InstantCommand(Subsystem subsystem)
Creates a new
InstantCommand with the given requirement. |
Modifier and Type | Method and Description |
---|---|
protected boolean |
isFinished()
Returns whether this command is finished.
|
cancel, clearRequirements, doesRequire, end, execute, getGroup, initialize, initSendable, interrupted, isCanceled, isCompleted, isInterruptible, isRunning, isTimedOut, requires, setInterruptible, setRunWhenDisabled, setTimeout, start, timeSinceInitialized, toString, willRunWhenDisabled
addChild, close, free, getName, getSubsystem, setName, setName, setName, setSubsystem
public InstantCommand()
public InstantCommand(String name)
InstantCommand
with the given name.name
- the name for this commandpublic InstantCommand(Subsystem subsystem)
InstantCommand
with the given requirement.subsystem
- the subsystem this command requirespublic InstantCommand(String name, Subsystem subsystem)
InstantCommand
with the given name and requirement.name
- the name for this commandsubsystem
- the subsystem this command requiresprotected boolean isFinished()
Command
end()
will be called.
It may be useful for a team to reference the isTimedOut()
method for time-sensitive commands.
Returning false will result in the command never ending automatically. It may still be
cancelled manually or interrupted by another command. Returning true will result in the
command executing once and finishing immediately. We recommend using InstantCommand
for this.
isFinished
in class Command
isTimedOut()