Command Groups
Command groups are an essential part of NextFTC. They allow you to group multiple commands together into more complex commands. NextFTC has four types of command groups.
SequentialGroup
A SequentialGroup takes an arbitrary number of commands and runs them, one after another, until the last one is done.
SequentialGroup(
command1,
command2,
// vararg Command
)A SequentialGroup can also be created with the .then helper function:
command1.then(
command2,
// vararg Command
)ParallelGroup
A ParallelGroup takes an arbitrary number of commands and runs them all at the same time, until they have all finished.
ParallelGroup(
command1,
command2,
// vararg Command
)A ParallelGroup can also be created with the .and helper function:
command1.and(
command2,
// vararg Command
)ParallelRaceGroup
A ParallelRaceGroup is very similar to a ParallelGroup in that they both run an arbitrary number of commands in parallel. However unlike a ParallelGroup, a ParallelRaceGroup only requires one of its children to finish before it finishes.
ParallelRaceGroup(
command1,
command2,
// vararg Command
)A ParallelRaceGroup can also be created with the .raceWith helper function:
command1.raceWith(
command2,
// vararg Command
)ParallelDeadlineGroup
A ParallelDeadlineGroup is very similar to a ParallelGroup and a ParallelRaceGroup. However unlike a ParallelRaceGroup, it has a special command (the deadline) and it finishes whenever the deadline finishes, no matter the status of the other commands.
ParallelDeadlineGroup(
deadlineCommand,
command2,
// vararg Command
)A ParallelDeadlineGroup can also be created with the .asDeadline helper function, where the function it is called on is the deadline:
deadlineCommand.asDeadline(
command2,
// vararg Command
)Additionally, it can be created with the .withDeadline helper method, which takes a parameter as a deadline.
command2.withDeadline(deadlineCommand)NOTE
See the command groups reference for more information.