Package org.wpilib.commands3
Class SequentialGroupBuilder
java.lang.Object
org.wpilib.commands3.SequentialGroupBuilder
A builder class to configure and then create a
SequentialGroup. Like StagedCommandBuilder, the final command is created by calling the terminal named(String) method, or with an automatically generated name using withAutomaticName().-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a command to the sequence.Adds commands to the sequence.Creates the sequence command, giving it the specified name.until(BooleanSupplier endCondition) Adds an end condition to the command group.Creates the sequence command, giving it an automatically generated name based on the commands in the sequence.
-
Constructor Details
-
SequentialGroupBuilder
public SequentialGroupBuilder()Creates new SequentialGroupBuilder. The builder will have no commands and have no preapplied configuration options. UseandThen(Command)to add commands to the sequence.
-
-
Method Details
-
andThen
Adds a command to the sequence.- Parameters:
next- The next command in the sequence- Returns:
- The builder object, for chaining
-
andThen
Adds commands to the sequence. Commands will be added to the sequence in the order they are passed to this method.- Parameters:
nextCommands- The next commands in the sequence- Returns:
- The builder object, for chaining
-
until
Adds an end condition to the command group. If this condition is met before all required commands have completed, the group will exit early. If multiple end conditions are added (e.g..until(() -> conditionA()).until(() -> conditionB())), then the last end condition added will be used and any previously configured condition will be overridden.- Parameters:
endCondition- The end condition for the group- Returns:
- The builder object, for chaining
-
named
Creates the sequence command, giving it the specified name.- Parameters:
name- The name of the sequence command- Returns:
- The built command
-
withAutomaticName
Creates the sequence command, giving it an automatically generated name based on the commands in the sequence.- Returns:
- The built command
-