WPILibC++
unspecified
|
The SendableChooser class is a useful tool for presenting a selection of options to the SmartDashboard. More...
#include <SendableChooser.h>
Public Member Functions | |
void | AddObject (const std::string &name, void *object) |
Adds the given object to the list of options. More... | |
void | AddDefault (const std::string &name, void *object) |
Add the given object to the list of options and marks it as the default. More... | |
void * | GetSelected () |
Returns the selected option. More... | |
void | InitTable (std::shared_ptr< ITable > subtable) override |
Initializes a table for this sendable object. More... | |
std::shared_ptr< ITable > | GetTable () const override |
std::string | GetSmartDashboardType () const override |
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.
void SendableChooser::AddDefault | ( | const std::string & | name, |
void * | object | ||
) |
Add the given object to the list of options and marks it as the default.
Functionally, this is very close to char *name, void *object) AddObject(...) except that it will use this as the default option if none other is explicitly selected.
name | the name of the option |
object | the option |
void SendableChooser::AddObject | ( | const std::string & | name, |
void * | object | ||
) |
Adds the given object to the list of options.
On the SmartDashboard on the desktop, the object will appear as the given name.
name | the name of the option |
object | the option |
void * SendableChooser::GetSelected | ( | ) |
Returns the selected option.
If there is none selected, it will return the default. If there is none selected and no default, then it will return
.
|
overridevirtual |
Implements frc::Sendable.
|
overridevirtual |
Implements frc::Sendable.
|
overridevirtual |
Initializes a table for this sendable object.
subtable | The table to put the values in. |
Implements frc::Sendable.