Scheduler

class commands1.Scheduler

Bases: _pyntcore._ntcore.NTSendable

The Scheduler is a singleton which holds the top-level running commands. It is in charge of both calling the command’s run() method and to make sure that there are no two commands with conflicting requirements running.

It is fine if teams wish to take control of the Scheduler themselves, all that needs to be done is to call frc::Scheduler::getInstance()->run() often to have Commands function correctly. However, this is already done for you if you use the CommandBased Robot template.

This class is provided by the OldCommands VendorDep

addButton(button: commands1._impl._commands_v1.button.ButtonScheduler) None
addCommand(command: commands1._impl._commands_v1.command.Command) None

Add a command to be scheduled later.

In any pass through the scheduler, all commands are added to the additions list, then at the end of the pass, they are all scheduled.

Parameters

command – The command to be scheduled

static addToSmartDashboard(key: str) None

This is equivalent to wpilib.SmartDashboard.putData(key, Scheduler.getInstance()). Use this instead, as SmartDashboard.putData will fail if used directly

Parameters

key – the key

static getInstance() commands1._impl._commands_v1.command.Scheduler

Returns the Scheduler, creating it if one does not exist.

Returns

the Scheduler

initSendable(builder: _pyntcore._ntcore.NTSendableBuilder) None
registerSubsystem(subsystem: commands1._impl._commands_v1.command.Subsystem) None

Registers a Subsystem to this Scheduler, so that the Scheduler might know if a default Command needs to be run.

All Subsystems should call this.

Parameters

subsystem – the system

remove(command: commands1._impl._commands_v1.command.Command) None

Removes the Command from the Scheduler.

Parameters

command – the command to remove

removeAll() None
resetAll() None

Completely resets the scheduler. Undefined behavior if running.

run() None

Runs a single iteration of the loop.

This method should be called often in order to have a functioning Command system. The loop has five stages:

<ol> - Poll the Buttons - Execute/Remove the Commands - Send values to SmartDashboard - Add Commands - Add Defaults </ol>

setEnabled(enabled: bool) None