Class SequentialGroupBuilder

java.lang.Object
org.wpilib.commands3.SequentialGroupBuilder

public class SequentialGroupBuilder extends Object
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 Details

    • SequentialGroupBuilder

      Creates new SequentialGroupBuilder. The builder will have no commands and have no preapplied configuration options. Use andThen(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

      public SequentialGroupBuilder andThen(Command... nextCommands)
      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

      public Command named(String name)
      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