|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.wpi.first.wpilibj.command.Command
edu.wpi.first.wpilibj.command.PrintCommand
public class PrintCommand
A PrintCommand
is a command which prints out a string when it is initialized, and then immediately finishes.
It is useful if you want a CommandGroup
to print out a string when it reaches a certain point.
Constructor Summary | |
---|---|
PrintCommand(java.lang.String message)
Instantiates a PrintCommand which will print the given message when it is run. |
Method Summary | |
---|---|
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. |
Methods inherited from class edu.wpi.first.wpilibj.command.Command |
---|
cancel, doesRequire, getGroup, getName, getSmartDashboardType, getTable, initTable, isCanceled, isInterruptible, isRunning, isTimedOut, requires, setInterruptible, setRunWhenDisabled, setTimeout, start, timeSinceInitialized, toString, willRunWhenDisabled |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PrintCommand(java.lang.String message)
PrintCommand
which will print the given message when it is run.
message
- the message to printMethod Detail |
---|
protected void initialize()
Command
initialize
in class Command
protected void execute()
Command
execute
in class Command
protected boolean isFinished()
Command
end()
will be called.
It may be useful for a team to reference the isTimedOut()
method
for time-sensitive commands.
isFinished
in class Command
isTimedOut()
protected void end()
Command
end
in class Command
protected void interrupted()
Command
cancel()
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 Command
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |