EasyCommandScheduler
The scheduler gives every scheduled command time on each loop and makes sure only one command controls a subsystem at a time. It is a singleton obtained with EasyCommandScheduler.getInstance(). EasyOpMode already holds it in the protected field scheduler.
#Running the Scheduler
The scheduler only does work when run() is called. The simplest way is to add an EasyCommandComponent in your EasyOpMode. In a plain OpMode, call scheduler.run() once per loop.
#Methods
schedule(command): starts a command. Commands that share a requirement are interrupted.cancel(command): cancels one command. Itsend(true)runs.cancelAll(): cancels every command.isScheduled(command): true while the command is scheduled.setDefaultCommand(subsystem, command): runs the command whenever nothing else uses that subsystem.getCurrentCommand(subsystem): the command that holds the subsystem, or null.addTrigger(trigger): registers a trigger to be polled on each run.run(): one scheduler iteration.reset(): clears commands, default commands and triggers.EasyOpModecalls it at the start and at the end.getActiveCommandNames(): names of the running commands, used by the dashboard.
#Requirements and Interruption
Each command declares the subsystems it needs. When you schedule a command that needs a subsystem already used by another command, the other command is interrupted and its end(true) runs.
#Default Commands
A default command runs when no other command is using its subsystem. It starts again automatically when the other command ends.
scheduler.setDefaultCommand(drive, new MecanumDriveCommand(
() -> driver.leftStickY(),
() -> driver.leftStickX(),
() -> driver.rightStickX(),
drive::driveWithMotorPowers,
drive));#Errors
If a command throws an exception, the scheduler ends that command with end(true), releases its requirements and rethrows the exception. The dashboard timeline shows the command as stopped by an error.
#Iteration Order
Each run() polls the triggers first, then executes every scheduled command, then schedules default commands for free subsystems.
Última actualización 2026-11-16