Package edu.wpi.first.wpilibj2.command
Class WaitUntilCommand
java.lang.Object
edu.wpi.first.wpilibj2.command.CommandBase
edu.wpi.first.wpilibj2.command.WaitUntilCommand
- All Implemented Interfaces:
Command
public class WaitUntilCommand extends CommandBase
A command that does nothing but ends after a specified match time or condition. Useful for
CommandGroups.
-
Constructor Summary
Constructors Constructor Description WaitUntilCommand(java.util.function.BooleanSupplier condition)
Creates a new WaitUntilCommand that ends after a given condition becomes true. -
Method Summary
Modifier and Type Method Description boolean
isFinished()
Creates a new WaitUntilCommand that ends after a given match time.boolean
runsWhenDisabled()
Whether the given command should run when the robot is disabled.Methods inherited from class edu.wpi.first.wpilibj2.command.CommandBase
addRequirements, getRequirements
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface edu.wpi.first.wpilibj2.command.Command
alongWith, andThen, asProxy, beforeStarting, cancel, deadlineWith, end, execute, getName, hasRequirement, initialize, interruptOn, isScheduled, perpetually, raceWith, schedule, schedule, whenFinished, withTimeout
-
Constructor Details
-
WaitUntilCommand
public WaitUntilCommand(java.util.function.BooleanSupplier condition)Creates a new WaitUntilCommand that ends after a given condition becomes true.- Parameters:
condition
- the condition to determine when to end
-
-
Method Details
-
isFinished
public boolean isFinished()Creates a new WaitUntilCommand that ends after a given match time.NOTE: The match timer used for this command is UNOFFICIAL. Using this command does NOT guarantee that the time at which the action is performed will be judged to be legal by the referees. When in doubt, add a safety factor or time the action manually.
- Parameters:
time
- the match time after which to end, in seconds- Returns:
- whether the command has finished.
-
runsWhenDisabled
public boolean runsWhenDisabled()Description copied from interface:Command
Whether the given command should run when the robot is disabled. Override to return true if the command should run when disabled.- Returns:
- whether the command should run when the robot is disabled
-