|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.wpi.first.wpilibj.command.Scheduler
public class Scheduler
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 Scheduler.getInstance()
.run()
often
to have Commands
function correctly. However, this is already done for you if you
use the CommandBased Robot template.
Command
Method Summary | |
---|---|
void |
add(Command command)
Adds the command to the Scheduler . |
void |
addButton(Button.ButtonScheduler button)
Adds a button to the Scheduler . |
static Scheduler |
getInstance()
Returns the Scheduler , creating it if one does not exist. |
java.lang.String |
getName()
Returns the name of this object. |
NetworkTable |
getTable()
Returns the NetworkTable associated with the data. |
java.lang.String |
getType()
Returns the type of the data. |
void |
run()
Runs a single iteration of the loop. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static Scheduler getInstance()
Scheduler
, creating it if one does not exist.
Scheduler
public 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(Button.ButtonScheduler button)
Scheduler
. The Scheduler
will poll the button
during its run()
.
button
- the button to addpublic void run()
Command
system. The loop has five stages:
public java.lang.String getName()
SmartDashboardNamedData
getName
in interface SmartDashboardNamedData
public java.lang.String getType()
SmartDashboardData
getTable()
.
For instance, if the type was "Button", then the SmartDashboard would show the data
as a button on the desktop and would know to look at and modify the "pressed" field in the
NetworkTable
returned by getTable()
.
getType
in interface SmartDashboardData
public NetworkTable getTable()
SmartDashboardData
NetworkTable
associated with the data.
The table should contain all the information the desktop version of SmartDashboard needs
to interact with the object. The data should both keep the table up-to-date and also react
to changes that the SmartDashboard might make.
For instance, the SendablePIDController
will put its p, i and d values into its table
and will change them if the table receives new values.
This method should return the same table between calls
getTable
in interface SmartDashboardData
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |