public class Scheduler extends Object implements NamedSendable
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
Scheduler.getInstance().run()
often to have Commands function correctly. However, this is
already done for you if you use the CommandBased Robot template.
Command| Modifier and Type | Method and Description |
|---|---|
void |
add(Command command)
Adds the command to the
Scheduler. |
void |
addButton(Trigger.ButtonScheduler button)
Adds a button to the
Scheduler. |
void |
disable()
Disable the command scheduler.
|
void |
enable()
Enable the command scheduler.
|
static Scheduler |
getInstance()
Returns the
Scheduler, creating it if one does not exist. |
String |
getName() |
String |
getSmartDashboardType() |
edu.wpi.first.wpilibj.tables.ITable |
getTable() |
String |
getType() |
void |
initTable(edu.wpi.first.wpilibj.tables.ITable subtable)
Initializes a table for this sendable object.
|
void |
removeAll()
Removes all commands
|
void |
run()
Runs a single iteration of the loop.
|
public static Scheduler getInstance()
Scheduler, creating it if one does not exist.Schedulerpublic void add(Command command)
Scheduler. This will not add the
Command immediately, but will instead wait for the proper time in
the run() loop before doing so. The command returns
immediately and does nothing if given null.
Adding a Command to the Scheduler involves the
Scheduler removing any Command which has shared
requirements.
command - the command to addpublic void addButton(Trigger.ButtonScheduler button)
button - the button to addpublic void run()
Command system. The loop has five
stages:
public void removeAll()
public void disable()
public void enable()
public String getName()
getName in interface NamedSendablepublic String getType()
public void initTable(edu.wpi.first.wpilibj.tables.ITable subtable)
public edu.wpi.first.wpilibj.tables.ITable getTable()
public String getSmartDashboardType()
getSmartDashboardType in interface SendableCopyright © 2015. All rights reserved.