◆ addButton()
void edu.wpi.first.wpilibj2.command.CommandScheduler.addButton |
( |
Runnable |
button | ) |
|
Adds a button binding to the scheduler, which will be polled to schedule commands.
- Parameters
-
◆ cancel()
void edu.wpi.first.wpilibj2.command.CommandScheduler.cancel |
( |
Command... |
commands | ) |
|
Cancels commands. The scheduler will only call Command#end(boolean) method of the canceled command with
, indicating they were canceled (as opposed to finishing normally).
Commands will be canceled even if they are not scheduled as interruptible.
- Parameters
-
commands | the commands to cancel |
◆ cancelAll()
void edu.wpi.first.wpilibj2.command.CommandScheduler.cancelAll |
( |
| ) |
|
Cancels all commands that are currently scheduled.
◆ clearButtons()
void edu.wpi.first.wpilibj2.command.CommandScheduler.clearButtons |
( |
| ) |
|
Removes all button bindings from the scheduler.
◆ close()
void edu.wpi.first.wpilibj2.command.CommandScheduler.close |
( |
| ) |
|
Changes the period of the loop overrun watchdog. This should be be kept in sync with the TimedRobot period.
- Parameters
-
◆ disable()
void edu.wpi.first.wpilibj2.command.CommandScheduler.disable |
( |
| ) |
|
Disables the command scheduler.
◆ enable()
void edu.wpi.first.wpilibj2.command.CommandScheduler.enable |
( |
| ) |
|
Enables the command scheduler.
◆ getDefaultCommand()
Command edu.wpi.first.wpilibj2.command.CommandScheduler.getDefaultCommand |
( |
Subsystem |
subsystem | ) |
|
Gets the default command associated with this subsystem. Null if this subsystem has no default command associated with it.
- Parameters
-
subsystem | the subsystem to inquire about |
- Returns
- the default command associated with the subsystem
◆ getInstance()
static synchronized CommandScheduler edu.wpi.first.wpilibj2.command.CommandScheduler.getInstance |
( |
| ) |
|
|
static |
Returns the Scheduler instance.
- Returns
- the instance
◆ isScheduled()
boolean edu.wpi.first.wpilibj2.command.CommandScheduler.isScheduled |
( |
Command... |
commands | ) |
|
Returns the time since a given command was scheduled. Note that this only works on commands that are directly scheduled by the scheduler; it will not work on commands inside of commandgroups, as the scheduler does not see them.
- Parameters
-
command | the command to query |
- Returns
- the time since the command was scheduled, in seconds Whether the given commands are running. Note that this only works on commands that are directly scheduled by the scheduler; it will not work on commands inside of CommandGroups, as the scheduler does not see them.
- Parameters
-
commands | the command to query |
- Returns
- whether the command is currently scheduled
◆ onCommandExecute()
void edu.wpi.first.wpilibj2.command.CommandScheduler.onCommandExecute |
( |
Consumer< Command > |
action | ) |
|
Adds an action to perform on the execution of any command by the scheduler.
- Parameters
-
action | the action to perform |
◆ onCommandFinish()
void edu.wpi.first.wpilibj2.command.CommandScheduler.onCommandFinish |
( |
Consumer< Command > |
action | ) |
|
Adds an action to perform on the finishing of any command by the scheduler.
- Parameters
-
action | the action to perform |
◆ onCommandInitialize()
void edu.wpi.first.wpilibj2.command.CommandScheduler.onCommandInitialize |
( |
Consumer< Command > |
action | ) |
|
Adds an action to perform on the initialization of any command by the scheduler.
- Parameters
-
action | the action to perform |
◆ onCommandInterrupt()
void edu.wpi.first.wpilibj2.command.CommandScheduler.onCommandInterrupt |
( |
Consumer< Command > |
action | ) |
|
Adds an action to perform on the interruption of any command by the scheduler.
- Parameters
-
action | the action to perform |
◆ registerSubsystem()
void edu.wpi.first.wpilibj2.command.CommandScheduler.registerSubsystem |
( |
Subsystem... |
subsystems | ) |
|
Registers subsystems with the scheduler. This must be called for the subsystem's periodic block to run when the scheduler is run, and for the subsystem's default command to be scheduled. It is recommended to call this from the constructor of your subsystem implementations.
- Parameters
-
subsystems | the subsystem to register |
◆ requiring()
Command edu.wpi.first.wpilibj2.command.CommandScheduler.requiring |
( |
Subsystem |
subsystem | ) |
|
Returns the command currently requiring a given subsystem. Null if no command is currently requiring the subsystem
- Parameters
-
subsystem | the subsystem to be inquired about |
- Returns
- the command currently requiring the subsystem
◆ run()
void edu.wpi.first.wpilibj2.command.CommandScheduler.run |
( |
| ) |
|
Runs a single iteration of the scheduler. The execution occurs in the following order:
Subsystem periodic methods are called.
Button bindings are polled, and new commands are scheduled from them.
Currently-scheduled commands are executed.
End conditions are checked on currently-scheduled commands, and commands that are finished have their end methods called and are removed.
Any subsystems not being used as requirements have their default methods started.
◆ schedule() [1/2]
void edu.wpi.first.wpilibj2.command.CommandScheduler.schedule |
( |
boolean |
interruptible, |
|
|
Command... |
commands |
|
) |
| |
Schedules multiple commands for execution. Does nothing if the command is already scheduled. If a command's requirements are not available, it will only be started if all the commands currently using those requirements have been scheduled as interruptible. If this is the case, they will be interrupted and the command will be scheduled.
- Parameters
-
interruptible | whether the commands should be interruptible |
commands | the commands to schedule |
◆ schedule() [2/2]
void edu.wpi.first.wpilibj2.command.CommandScheduler.schedule |
( |
Command... |
commands | ) |
|
Schedules multiple commands for execution, with interruptible defaulted to true. Does nothing if the command is already scheduled.
- Parameters
-
commands | the commands to schedule |
◆ setDefaultCommand()
void edu.wpi.first.wpilibj2.command.CommandScheduler.setDefaultCommand |
( |
Subsystem |
subsystem, |
|
|
Command |
defaultCommand |
|
) |
| |
Sets the default command for a subsystem. Registers that subsystem if it is not already registered. Default commands will run whenever there is no other command currently scheduled that requires the subsystem. Default commands should be written to never end (i.e. their Command#isFinished() method should return false), as they would simply be re-scheduled if they do. Default commands must also require their subsystem.
- Parameters
-
subsystem | the subsystem whose default command will be set |
defaultCommand | the default command to associate with the subsystem |
◆ unregisterSubsystem()
void edu.wpi.first.wpilibj2.command.CommandScheduler.unregisterSubsystem |
( |
Subsystem... |
subsystems | ) |
|
Un-registers subsystems with the scheduler. The subsystem will no longer have its periodic block called, and will not have its default command scheduled.
- Parameters
-
subsystems | the subsystem to un-register |
The documentation for this class was generated from the following file:
- D:/SDASVN/2022/RaspberryPi/Source/edu/wpi/first/wpilibj2/command/CommandScheduler.java