Robot Core Documentation
Loading...
Searching...
No Matches
edu.wpi.first.wpilibj2.command.Commands Class Reference

Static Public Member Functions

static Command none ()
 
static Command idle (Subsystem... requirements)
 
static Command runOnce (Runnable action, Subsystem... requirements)
 
static Command run (Runnable action, Subsystem... requirements)
 
static Command startEnd (Runnable start, Runnable end, Subsystem... requirements)
 
static Command runEnd (Runnable run, Runnable end, Subsystem... requirements)
 
static Command print (String message)
 
static Command waitSeconds (double seconds)
 
static Command waitUntil (BooleanSupplier condition)
 
static Command either (Command onTrue, Command onFalse, BooleanSupplier selector)
 
static< K > Command select (Map< K, Command > commands, Supplier<? extends K > selector)
 
static Command defer (Supplier< Command > supplier, Set< Subsystem > requirements)
 
static Command deferredProxy (Supplier< Command > supplier)
 
static Command sequence (Command... commands)
 
static Command repeatingSequence (Command... commands)
 
static Command parallel (Command... commands)
 
static Command race (Command... commands)
 
static Command deadline (Command deadline, Command... otherCommands)
 

Detailed Description

Namespace for command factory methods.

For convenience, you might want to static import the members of this class.

Member Function Documentation

◆ deadline()

static Command edu.wpi.first.wpilibj2.command.Commands.deadline ( Command deadline,
Command... otherCommands )
static

Runs a group of commands at the same time. Ends once a specific command finishes, and cancels the others.

Parameters
deadlinethe deadline command
otherCommandsthe other commands to include
Returns
the command group
See also
ParallelDeadlineGroup
Exceptions
IllegalArgumentExceptionif the deadline command is also in the otherCommands argument

◆ defer()

static Command edu.wpi.first.wpilibj2.command.Commands.defer ( Supplier< Command > supplier,
Set< Subsystem > requirements )
static

Runs the command supplied by the supplier.

Parameters
supplierthe command supplier
requirementsthe set of requirements for this command
Returns
the command
See also
DeferredCommand

◆ deferredProxy()

static Command edu.wpi.first.wpilibj2.command.Commands.deferredProxy ( Supplier< Command > supplier)
static

Constructs a command that schedules the command returned from the supplier when initialized, and ends when it is no longer scheduled. The supplier is called when the command is initialized.

Parameters
supplierthe command supplier
Returns
the command
See also
ProxyCommand

◆ either()

static Command edu.wpi.first.wpilibj2.command.Commands.either ( Command onTrue,
Command onFalse,
BooleanSupplier selector )
static

Runs one of two commands, based on the boolean selector function.

Parameters
onTruethe command to run if the selector function returns true
onFalsethe command to run if the selector function returns false
selectorthe selector function
Returns
the command
See also
ConditionalCommand

◆ idle()

static Command edu.wpi.first.wpilibj2.command.Commands.idle ( Subsystem... requirements)
static

Constructs a command that does nothing until interrupted.

Parameters
requirementsSubsystems to require
Returns
the command

◆ none()

static Command edu.wpi.first.wpilibj2.command.Commands.none ( )
static

Constructs a command that does nothing, finishing immediately.

Returns
the command

◆ parallel()

static Command edu.wpi.first.wpilibj2.command.Commands.parallel ( Command... commands)
static

Runs a group of commands at the same time. Ends once all commands in the group finish.

Parameters
commandsthe commands to include
Returns
the command
See also
ParallelCommandGroup

◆ print()

static Command edu.wpi.first.wpilibj2.command.Commands.print ( String message)
static

Constructs a command that prints a message and finishes.

Parameters
messagethe message to print
Returns
the command
See also
PrintCommand

◆ race()

static Command edu.wpi.first.wpilibj2.command.Commands.race ( Command... commands)
static

Runs a group of commands at the same time. Ends once any command in the group finishes, and cancels the others.

Parameters
commandsthe commands to include
Returns
the command group
See also
ParallelRaceGroup

◆ repeatingSequence()

static Command edu.wpi.first.wpilibj2.command.Commands.repeatingSequence ( Command... commands)
static

Runs a group of commands in series, one after the other. Once the last command ends, the group is restarted.

Parameters
commandsthe commands to include
Returns
the command group
See also
SequentialCommandGroup
Command.repeatedly()

◆ run()

static Command edu.wpi.first.wpilibj2.command.Commands.run ( Runnable action,
Subsystem... requirements )
static

Constructs a command that runs an action every iteration until interrupted.

Parameters
actionthe action to run
requirementssubsystems the action requires
Returns
the command
See also
RunCommand

◆ runEnd()

static Command edu.wpi.first.wpilibj2.command.Commands.runEnd ( Runnable run,
Runnable end,
Subsystem... requirements )
static

Constructs a command that runs an action every iteration until interrupted, and then runs a second action.

Parameters
runthe action to run every iteration
endthe action to run on interrupt
requirementssubsystems the action requires
Returns
the command

◆ runOnce()

static Command edu.wpi.first.wpilibj2.command.Commands.runOnce ( Runnable action,
Subsystem... requirements )
static

Constructs a command that runs an action once and finishes.

Parameters
actionthe action to run
requirementssubsystems the action requires
Returns
the command
See also
InstantCommand

◆ select()

static< K > Command edu.wpi.first.wpilibj2.command.Commands.select ( Map< K, Command > commands,
Supplier<? extends K > selector )
static

Runs one of several commands, based on the selector function.

Parameters
<K>The type of key used to select the command
selectorthe selector function
commandsmap of commands to select from
Returns
the command
See also
SelectCommand

◆ sequence()

static Command edu.wpi.first.wpilibj2.command.Commands.sequence ( Command... commands)
static

Runs a group of commands in series, one after the other.

Parameters
commandsthe commands to include
Returns
the command group
See also
SequentialCommandGroup

◆ startEnd()

static Command edu.wpi.first.wpilibj2.command.Commands.startEnd ( Runnable start,
Runnable end,
Subsystem... requirements )
static

Constructs a command that runs an action once and another action when the command is interrupted.

Parameters
startthe action to run on start
endthe action to run on interrupt
requirementssubsystems the action requires
Returns
the command
See also
StartEndCommand

◆ waitSeconds()

static Command edu.wpi.first.wpilibj2.command.Commands.waitSeconds ( double seconds)
static

Constructs a command that does nothing, finishing after a specified duration.

Parameters
secondsafter how long the command finishes
Returns
the command
See also
WaitCommand

◆ waitUntil()

static Command edu.wpi.first.wpilibj2.command.Commands.waitUntil ( BooleanSupplier condition)
static

Constructs a command that does nothing, finishing once a condition becomes true.

Parameters
conditionthe condition
Returns
the command
See also
WaitUntilCommand

The documentation for this class was generated from the following file: