|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.wpi.first.wpilibj.smartdashboard.SendableChooser
public class SendableChooser
The SendableChooser
class is a useful tool for presenting a selection of options
to the SmartDashboard
.
For instance, you may wish to be able to select between multiple autonomous modes.
You can do this by putting every possible Command
you want to run as an autonomous into
a SendableChooser
and then put it into the SmartDashboard
to have a list of options
appear on the laptop. Once autonomous starts, simply ask the SendableChooser
what the selected
value is.
Constructor Summary | |
---|---|
SendableChooser()
Instantiates a SendableChooser . |
Method Summary | |
---|---|
void |
addDefault(java.lang.String name,
java.lang.Object object)
Add the given object to the list of options and marks it as the default. |
void |
addObject(java.lang.String name,
java.lang.Object object)
Adds the given object to the list of options. |
java.lang.Object |
getSelected()
Returns the selected option. |
NetworkTable |
getTable()
Returns the NetworkTable associated with the data. |
java.lang.String |
getType()
Returns the type of the data. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SendableChooser()
SendableChooser
.
Method Detail |
---|
public void addObject(java.lang.String name, java.lang.Object object)
SmartDashboard
on the desktop,
the object will appear as the given name.
name
- the name of the optionobject
- the optionpublic void addDefault(java.lang.String name, java.lang.Object object)
addObject(...)
except that it will use this as the default option if none other is explicitly selected.
name
- the name of the optionobject
- the optionpublic java.lang.Object getSelected()
null
.
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 |