public class SendableChooser extends Object implements Sendable
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,
Object object)
Add the given object to the list of options and marks it as the default.
|
void |
addObject(String name,
Object object)
Adds the given object to the list of options.
|
Object |
getSelected()
Returns the selected option.
|
String |
getSmartDashboardType() |
edu.wpi.first.wpilibj.tables.ITable |
getTable() |
void |
initTable(edu.wpi.first.wpilibj.tables.ITable table)
Initializes a table for this sendable object.
|
public SendableChooser()
SendableChooser
.public void addObject(String name, Object object)
SmartDashboard
on the desktop, the object will appear as the
given name.name
- the name of the optionobject
- the optionpublic void addDefault(String name, 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 Object getSelected()
null
.public String getSmartDashboardType()
getSmartDashboardType
in interface Sendable
public void initTable(edu.wpi.first.wpilibj.tables.ITable table)
Sendable
Copyright © 2015. All rights reserved.