V
- The type of the values to be storedpublic class SendableChooser<V> extends SendableBase
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 and Description |
---|
SendableChooser()
Instantiates a
SendableChooser . |
Modifier and Type | Method and Description |
---|---|
void |
addDefault(String name,
V object)
Deprecated.
Use
setDefaultOption(String, Object) instead. |
void |
addObject(String name,
V object)
Deprecated.
Use
addOption(String, Object) instead. |
void |
addOption(String name,
V object)
Adds the given object to the list of options.
|
V |
getSelected()
Returns the selected option.
|
void |
initSendable(SendableBuilder builder)
Initializes this
Sendable object. |
void |
setDefaultOption(String name,
V object)
Adds the given object to the list of options and marks it as the default.
|
addChild, close, free, getName, getSubsystem, setName, setName, setName, setSubsystem
public SendableChooser()
SendableChooser
.public void addOption(String name, V object)
SmartDashboard
on the desktop, the
object will appear as the given name.name
- the name of the optionobject
- the option@Deprecated public void addObject(String name, V object)
addOption(String, Object)
instead.name
- the name of the optionobject
- the optionpublic void setDefaultOption(String name, V object)
addOption(String, Object)
except that it will use this as the default
option if none other is explicitly selected.name
- the name of the optionobject
- the option@Deprecated public void addDefault(String name, V object)
setDefaultOption(String, Object)
instead.name
- the name of the optionobject
- the optionpublic V getSelected()
null
.public void initSendable(SendableBuilder builder)
Sendable
Sendable
object.builder
- sendable builder