public class StartCommand extends Command
StartCommand will call the start() method of another command when it is initialized
and will finish immediately.| Constructor and Description |
|---|
StartCommand(Command commandToStart)
Instantiates a
StartCommand which will start the
given command whenever its initialize() is called. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
end()
Called when the command ended peacefully.
|
protected void |
execute()
The execute method is called repeatedly until this Command either finishes
or is canceled.
|
protected void |
initialize()
The initialize method is called the first time this Command is run after
being started.
|
protected void |
interrupted()
Called when the command ends because somebody called
cancel()
or another command shared the same requirements as this one, and booted
it out. |
protected boolean |
isFinished()
Returns whether this command is finished.
|
cancel, doesRequire, getGroup, getName, getSmartDashboardType, getTable, initTable, isCanceled, isInterruptible, isRunning, isTimedOut, requires, setInterruptible, setRunWhenDisabled, setTimeout, start, timeSinceInitialized, toString, willRunWhenDisabledpublic StartCommand(Command commandToStart)
StartCommand which will start the
given command whenever its initialize() is called.commandToStart - the Command to startprotected void initialize()
Commandinitialize in class Commandprotected void execute()
Commandprotected boolean isFinished()
Commandend() will be called.
It may be useful for a team to reference the isTimedOut() method
for time-sensitive commands.
isFinished in class CommandisTimedOut()protected void end()
Commandprotected void interrupted()
Commandcancel()
or another command shared the same requirements as this one, and booted
it out.
This is where you may want to wrap up loose ends, like shutting off a motor that was being used in the command.
Generally, it is useful to simply call the end() method
within this method
interrupted in class CommandCopyright © 2015. All rights reserved.