edu.wpi.first.wpilibj.command
Class WaitForChildren

java.lang.Object
  extended by edu.wpi.first.wpilibj.command.Command
      extended by edu.wpi.first.wpilibj.command.WaitForChildren
All Implemented Interfaces:
SmartDashboardData, SmartDashboardNamedData

public class WaitForChildren
extends Command

This command will only finish if whatever CommandGroup it is in has no active children. If it is not a part of a CommandGroup, then it will finish immediately. If it is itself an active child, then the CommandGroup will never end.

This class is useful for the situation where you want to allow anything running in parallel to finish, before continuing in the main CommandGroup sequence.

Author:
Joe Grinstead

Constructor Summary
WaitForChildren()
           
 
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, getTable, getType, grabTable, 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

WaitForChildren

public WaitForChildren()
Method Detail

initialize

protected void initialize()
Description copied from class: Command
The initialize method is called the first time this Command is run after being started.

Specified by:
initialize in class Command

execute

protected void execute()
Description copied from class: Command
The execute method is called repeatedly until this Command either finishes or is canceled.

Specified by:
execute in class Command

end

protected void end()
Description copied from class: Command
Called when the command ended peacefully. This is where you may want to wrap up loose ends, like shutting off a motor that was being used in the command.

Specified by:
end in class Command

interrupted

protected void interrupted()
Description copied from class: Command
Called when the command ends because somebody called 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

Specified by:
interrupted in class Command

isFinished

protected boolean isFinished()
Description copied from class: Command
Returns whether this command is finished. If it is, then the command will be removed and end() will be called.

It may be useful for a team to reference the isTimedOut() method for time-sensitive commands.

Specified by:
isFinished in class Command
Returns:
whether this command is finished.
See Also:
isTimedOut()