Package org.wpilib.commands3
Class ParallelGroupBuilder
java.lang.Object
org.wpilib.commands3.ParallelGroupBuilder
A builder class to configure and then create a
ParallelGroup. 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 group.Creates the group, using the provided named.Adds one or more optional commands to the group.Adds one or more required commands to the group.until(BooleanSupplier condition) Adds an end condition to the command group.Creates the group, giving it a name based on the commands within the group.
-
Constructor Details
-
ParallelGroupBuilder
public ParallelGroupBuilder()Creates a new parallel group builder. The builder will have no commands and have no preapplied configuration options.
-
-
Method Details
-
optional
Adds one or more optional commands to the group. They will not be required to complete for the parallel group to exit, and will be canceled once all required commands have finished.- Parameters:
commands- The optional commands to add to the group- Returns:
- The builder object, for chaining
-
requiring
Adds one or more required commands to the group. All required commands will need to complete for the group to exit.- Parameters:
commands- The required commands to add to the group- Returns:
- The builder object, for chaining
-
alongWith
Adds a command to the group. The command must complete for the group to exit.- Parameters:
command- The command to add to the group- 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:
condition- The end condition for the group. May be null.- Returns:
- The builder object, for chaining
-
named
Creates the group, using the provided named. The group will require everything that the commands in the group require, and will have a priority level equal to the highest priority among those commands.- Parameters:
name- The name of the parallel group- Returns:
- The built group
-
withAutomaticName
Creates the group, giving it a name based on the commands within the group.- Returns:
- The built group
-