WPILibC++  2020.3.2-60-g3011ebe
frc::SmartDashboard Class Reference
Inheritance diagram for frc::SmartDashboard:
frc::ErrorBase frc::Sendable frc::SendableHelper< SmartDashboard >

Static Public Member Functions

static void init ()
 
static bool ContainsKey (wpi::StringRef key)
 Determines whether the given key is in this table. More...
 
static std::vector< std::string > GetKeys (int types=0)
 
static void SetPersistent (wpi::StringRef key)
 Makes a key's value persistent through program restarts. More...
 
static void ClearPersistent (wpi::StringRef key)
 Stop making a key's value persistent through program restarts. More...
 
static bool IsPersistent (wpi::StringRef key)
 Returns whether the value is persistent through program restarts. More...
 
static void SetFlags (wpi::StringRef key, unsigned int flags)
 Sets flags on the specified key in this table. More...
 
static void ClearFlags (wpi::StringRef key, unsigned int flags)
 Clears flags on the specified key in this table. More...
 
static unsigned int GetFlags (wpi::StringRef key)
 Returns the flags for the specified key. More...
 
static void Delete (wpi::StringRef key)
 Deletes the specified key in this table. More...
 
static nt::NetworkTableEntry GetEntry (wpi::StringRef key)
 Returns an NT Entry mapping to the specified key. More...
 
static void PutData (wpi::StringRef key, Sendable *data)
 Maps the specified key to the specified value in this table. More...
 
static void PutData (Sendable *value)
 Maps the specified key (where the key is the name of the Sendable) to the specified value in this table. More...
 
static SendableGetData (wpi::StringRef keyName)
 Returns the value at the specified key. More...
 
static bool PutBoolean (wpi::StringRef keyName, bool value)
 Maps the specified key to the specified value in this table. More...
 
static bool SetDefaultBoolean (wpi::StringRef key, bool defaultValue)
 Gets the current value in the table, setting it if it does not exist. More...
 
static bool GetBoolean (wpi::StringRef keyName, bool defaultValue)
 Returns the value at the specified key. More...
 
static bool PutNumber (wpi::StringRef keyName, double value)
 Maps the specified key to the specified value in this table. More...
 
static bool SetDefaultNumber (wpi::StringRef key, double defaultValue)
 Gets the current value in the table, setting it if it does not exist. More...
 
static double GetNumber (wpi::StringRef keyName, double defaultValue)
 Returns the value at the specified key. More...
 
static bool PutString (wpi::StringRef keyName, wpi::StringRef value)
 Maps the specified key to the specified value in this table. More...
 
static bool SetDefaultString (wpi::StringRef key, wpi::StringRef defaultValue)
 Gets the current value in the table, setting it if it does not exist. More...
 
static std::string GetString (wpi::StringRef keyName, wpi::StringRef defaultValue)
 Returns the value at the specified key. More...
 
static bool PutBooleanArray (wpi::StringRef key, wpi::ArrayRef< int > value)
 Put a boolean array in the table. More...
 
static bool SetDefaultBooleanArray (wpi::StringRef key, wpi::ArrayRef< int > defaultValue)
 Gets the current value in the table, setting it if it does not exist. More...
 
static std::vector< int > GetBooleanArray (wpi::StringRef key, wpi::ArrayRef< int > defaultValue)
 Returns the boolean array the key maps to. More...
 
static bool PutNumberArray (wpi::StringRef key, wpi::ArrayRef< double > value)
 Put a number array in the table. More...
 
static bool SetDefaultNumberArray (wpi::StringRef key, wpi::ArrayRef< double > defaultValue)
 Gets the current value in the table, setting it if it does not exist. More...
 
static std::vector< double > GetNumberArray (wpi::StringRef key, wpi::ArrayRef< double > defaultValue)
 Returns the number array the key maps to. More...
 
static bool PutStringArray (wpi::StringRef key, wpi::ArrayRef< std::string > value)
 Put a string array in the table. More...
 
static bool SetDefaultStringArray (wpi::StringRef key, wpi::ArrayRef< std::string > defaultValue)
 Gets the current value in the table, setting it if it does not exist. More...
 
static std::vector< std::string > GetStringArray (wpi::StringRef key, wpi::ArrayRef< std::string > defaultValue)
 Returns the string array the key maps to. More...
 
static bool PutRaw (wpi::StringRef key, wpi::StringRef value)
 Put a raw value (byte array) in the table. More...
 
static bool SetDefaultRaw (wpi::StringRef key, wpi::StringRef defaultValue)
 Gets the current value in the table, setting it if it does not exist. More...
 
static std::string GetRaw (wpi::StringRef key, wpi::StringRef defaultValue)
 Returns the raw value (byte array) the key maps to. More...
 
static bool PutValue (wpi::StringRef keyName, std::shared_ptr< nt::Value > value)
 Maps the specified key to the specified complex value (such as an array) in this table. More...
 
static bool SetDefaultValue (wpi::StringRef key, std::shared_ptr< nt::Value > defaultValue)
 Gets the current value in the table, setting it if it does not exist. More...
 
static std::shared_ptr< nt::ValueGetValue (wpi::StringRef keyName)
 Retrieves the complex value (such as an array) in this table into the complex data object. More...
 
static void PostListenerTask (std::function< void()> task)
 Posts a task from a listener to the ListenerExecutor, so that it can be run synchronously from the main loop on the next call to {}. More...
 
static void UpdateValues ()
 Puts all sendable data to the dashboard.
 
- Static Public Member Functions inherited from frc::ErrorBase
static void SetGlobalError (Error::Code code, const wpi::Twine &contextMessage, wpi::StringRef filename, wpi::StringRef function, int lineNumber)
 
static void SetGlobalWPIError (const wpi::Twine &errorMessage, const wpi::Twine &contextMessage, wpi::StringRef filename, wpi::StringRef function, int lineNumber)
 
static Error GetGlobalError ()
 Retrieve the last global error.
 
static std::vector< ErrorGetGlobalErrors ()
 Retrieve all global errors.
 

Additional Inherited Members

- Public Member Functions inherited from frc::ErrorBase
 ErrorBase (const ErrorBase &)=default
 
ErrorBaseoperator= (const ErrorBase &)=default
 
 ErrorBase (ErrorBase &&)=default
 
ErrorBaseoperator= (ErrorBase &&)=default
 
virtual ErrorGetError ()
 Retrieve the current error. More...
 
virtual const ErrorGetError () const
 Retrieve the current error. More...
 
virtual void ClearError () const
 Clear the current error information associated with this sensor.
 
virtual void SetErrnoError (const wpi::Twine &contextMessage, wpi::StringRef filename, wpi::StringRef function, int lineNumber) const
 Set error information associated with a C library call that set an error to the "errno" global variable. More...
 
virtual void SetImaqError (int success, const wpi::Twine &contextMessage, wpi::StringRef filename, wpi::StringRef function, int lineNumber) const
 Set the current error information associated from the nivision Imaq API. More...
 
virtual void SetError (Error::Code code, const wpi::Twine &contextMessage, wpi::StringRef filename, wpi::StringRef function, int lineNumber) const
 Set the current error information associated with this sensor. More...
 
virtual void SetErrorRange (Error::Code code, int32_t minRange, int32_t maxRange, int32_t requestedValue, const wpi::Twine &contextMessage, wpi::StringRef filename, wpi::StringRef function, int lineNumber) const
 Set the current error information associated with this sensor. More...
 
virtual void SetWPIError (const wpi::Twine &errorMessage, Error::Code code, const wpi::Twine &contextMessage, wpi::StringRef filename, wpi::StringRef function, int lineNumber) const
 Set the current error information associated with this sensor. More...
 
virtual void CloneError (const ErrorBase &rhs) const
 
virtual bool StatusIsFatal () const
 Check if the current error code represents a fatal error. More...
 
void ClearGlobalErrors ()
 Clear global errors.
 
- Public Member Functions inherited from frc::Sendable
virtual void InitSendable (SendableBuilder &builder)=0
 Initializes this Sendable object. More...
 
- Public Member Functions inherited from frc::SendableHelper< SmartDashboard >
 SendableHelper (const SendableHelper &rhs)=default
 
 SendableHelper (SendableHelper &&rhs)
 
SendableHelperoperator= (const SendableHelper &rhs)=default
 
SendableHelperoperator= (SendableHelper &&rhs)
 
std::string GetName () const
 Gets the name of this Sendable object. More...
 
void SetName (const wpi::Twine &name)
 Sets the name of this Sendable object. More...
 
void SetName (const wpi::Twine &subsystem, const wpi::Twine &name)
 Sets both the subsystem name and device name of this Sendable object. More...
 
std::string GetSubsystem () const
 Gets the subsystem name of this Sendable object. More...
 
void SetSubsystem (const wpi::Twine &subsystem)
 Sets the subsystem name of this Sendable object. More...
 
- Protected Member Functions inherited from frc::SendableHelper< SmartDashboard >
void SetName (const wpi::Twine &moduleType, int channel)
 Sets the name of the sensor with a channel number. More...
 
void SetName (const wpi::Twine &moduleType, int moduleNumber, int channel)
 Sets the name of the sensor with a module and channel number. More...
 
void AddChild (std::shared_ptr< Sendable > child)
 Add a child component. More...
 
void AddChild (void *child)
 Add a child component. More...
 
- Protected Attributes inherited from frc::ErrorBase
Error m_error
 

Member Function Documentation

◆ ClearFlags()

static void frc::SmartDashboard::ClearFlags ( wpi::StringRef  key,
unsigned int  flags 
)
static

Clears flags on the specified key in this table.

The key can not be null.

Parameters
keythe key name
flagsthe flags to clear (bitmask)

◆ ClearPersistent()

static void frc::SmartDashboard::ClearPersistent ( wpi::StringRef  key)
static

Stop making a key's value persistent through program restarts.

The key cannot be null.

Parameters
keythe key name

◆ ContainsKey()

static bool frc::SmartDashboard::ContainsKey ( wpi::StringRef  key)
static

Determines whether the given key is in this table.

Parameters
keythe key to search for
Returns
true if the table as a value assigned to the given key

◆ Delete()

static void frc::SmartDashboard::Delete ( wpi::StringRef  key)
static

Deletes the specified key in this table.

Parameters
keythe key name

◆ GetBoolean()

static bool frc::SmartDashboard::GetBoolean ( wpi::StringRef  keyName,
bool  defaultValue 
)
static

Returns the value at the specified key.

If the key is not found, returns the default value.

Parameters
keyNamethe key
Returns
the value

◆ GetBooleanArray()

static std::vector<int> frc::SmartDashboard::GetBooleanArray ( wpi::StringRef  key,
wpi::ArrayRef< int >  defaultValue 
)
static

Returns the boolean array the key maps to.

If the key does not exist or is of different type, it will return the default value.

Parameters
keyThe key to look up.
defaultValueThe value to be returned if no value is found.
Returns
the value associated with the given key or the given default value if there is no value associated with the key
Note
This makes a copy of the array. If the overhead of this is a concern, use GetValue() instead.
The returned array is std::vector<int> instead of std::vector<bool> because std::vector<bool> is special-cased in C++. 0 is false, any non-zero value is true.

◆ GetData()

static Sendable* frc::SmartDashboard::GetData ( wpi::StringRef  keyName)
static

Returns the value at the specified key.

Parameters
keyNamethe key
Returns
the value

◆ GetEntry()

static nt::NetworkTableEntry frc::SmartDashboard::GetEntry ( wpi::StringRef  key)
static

Returns an NT Entry mapping to the specified key.

This is useful if an entry is used often, or is read and then modified.

Parameters
keythe key
Returns
the entry for the key

◆ GetFlags()

static unsigned int frc::SmartDashboard::GetFlags ( wpi::StringRef  key)
static

Returns the flags for the specified key.

Parameters
keythe key name
Returns
the flags, or 0 if the key is not defined

◆ GetKeys()

static std::vector<std::string> frc::SmartDashboard::GetKeys ( int  types = 0)
static
Parameters
typesbitmask of types; 0 is treated as a "don't care".
Returns
keys currently in the table

◆ GetNumber()

static double frc::SmartDashboard::GetNumber ( wpi::StringRef  keyName,
double  defaultValue 
)
static

Returns the value at the specified key.

If the key is not found, returns the default value.

Parameters
keyNamethe key
Returns
the value

◆ GetNumberArray()

static std::vector<double> frc::SmartDashboard::GetNumberArray ( wpi::StringRef  key,
wpi::ArrayRef< double >  defaultValue 
)
static

Returns the number array the key maps to.

If the key does not exist or is of different type, it will return the default value.

Parameters
keyThe key to look up.
defaultValueThe value to be returned if no value is found.
Returns
the value associated with the given key or the given default value if there is no value associated with the key
Note
This makes a copy of the array. If the overhead of this is a concern, use GetValue() instead.

◆ GetRaw()

static std::string frc::SmartDashboard::GetRaw ( wpi::StringRef  key,
wpi::StringRef  defaultValue 
)
static

Returns the raw value (byte array) the key maps to.

If the key does not exist or is of different type, it will return the default value.

Parameters
keyThe key to look up.
defaultValueThe value to be returned if no value is found.
Returns
the value associated with the given key or the given default value if there is no value associated with the key
Note
This makes a copy of the raw contents. If the overhead of this is a concern, use GetValue() instead.

◆ GetString()

static std::string frc::SmartDashboard::GetString ( wpi::StringRef  keyName,
wpi::StringRef  defaultValue 
)
static

Returns the value at the specified key.

If the key is not found, returns the default value.

Parameters
keyNamethe key
Returns
the value

◆ GetStringArray()

static std::vector<std::string> frc::SmartDashboard::GetStringArray ( wpi::StringRef  key,
wpi::ArrayRef< std::string >  defaultValue 
)
static

Returns the string array the key maps to.

If the key does not exist or is of different type, it will return the default value.

Parameters
keyThe key to look up.
defaultValueThe value to be returned if no value is found.
Returns
the value associated with the given key or the given default value if there is no value associated with the key
Note
This makes a copy of the array. If the overhead of this is a concern, use GetValue() instead.

◆ GetValue()

static std::shared_ptr<nt::Value> frc::SmartDashboard::GetValue ( wpi::StringRef  keyName)
static

Retrieves the complex value (such as an array) in this table into the complex data object.

Parameters
keyNamethe key
valuethe object to retrieve the value into

◆ IsPersistent()

static bool frc::SmartDashboard::IsPersistent ( wpi::StringRef  key)
static

Returns whether the value is persistent through program restarts.

The key cannot be null.

Parameters
keythe key name

◆ PostListenerTask()

static void frc::SmartDashboard::PostListenerTask ( std::function< void()>  task)
static

Posts a task from a listener to the ListenerExecutor, so that it can be run synchronously from the main loop on the next call to {}.

Parameters
taskThe task to run synchronously from the main thread.

◆ PutBoolean()

static bool frc::SmartDashboard::PutBoolean ( wpi::StringRef  keyName,
bool  value 
)
static

Maps the specified key to the specified value in this table.

The value can be retrieved by calling the get method with a key that is equal to the original key.

Parameters
keyNamethe key
valuethe value
Returns
False if the table key already exists with a different type

◆ PutBooleanArray()

static bool frc::SmartDashboard::PutBooleanArray ( wpi::StringRef  key,
wpi::ArrayRef< int >  value 
)
static

Put a boolean array in the table.

Parameters
keythe key to be assigned to
valuethe value that will be assigned
Returns
False if the table key already exists with a different type
Note
The array must be of int's rather than of bool's because std::vector<bool> is special-cased in C++. 0 is false, any non-zero value is true.

◆ PutData() [1/2]

static void frc::SmartDashboard::PutData ( Sendable value)
static

Maps the specified key (where the key is the name of the Sendable) to the specified value in this table.

The value can be retrieved by calling the get method with a key that is equal to the original key.

In order for the value to appear in the dashboard, it must be registered with SendableRegistry. WPILib components do this automatically.

Parameters
valuethe value

◆ PutData() [2/2]

static void frc::SmartDashboard::PutData ( wpi::StringRef  key,
Sendable data 
)
static

Maps the specified key to the specified value in this table.

The value can be retrieved by calling the get method with a key that is equal to the original key.

In order for the value to appear in the dashboard, it must be registered with SendableRegistry. WPILib components do this automatically.

Parameters
keyNamethe key
valuethe value

◆ PutNumber()

static bool frc::SmartDashboard::PutNumber ( wpi::StringRef  keyName,
double  value 
)
static

Maps the specified key to the specified value in this table.

The value can be retrieved by calling the get method with a key that is equal to the original key.

Parameters
keyNamethe key
valuethe value
Returns
False if the table key already exists with a different type

◆ PutNumberArray()

static bool frc::SmartDashboard::PutNumberArray ( wpi::StringRef  key,
wpi::ArrayRef< double >  value 
)
static

Put a number array in the table.

Parameters
keyThe key to be assigned to.
valueThe value that will be assigned.
Returns
False if the table key already exists with a different type

◆ PutRaw()

static bool frc::SmartDashboard::PutRaw ( wpi::StringRef  key,
wpi::StringRef  value 
)
static

Put a raw value (byte array) in the table.

Parameters
keyThe key to be assigned to.
valueThe value that will be assigned.
Returns
False if the table key already exists with a different type

◆ PutString()

static bool frc::SmartDashboard::PutString ( wpi::StringRef  keyName,
wpi::StringRef  value 
)
static

Maps the specified key to the specified value in this table.

The value can be retrieved by calling the get method with a key that is equal to the original key.

Parameters
keyNamethe key
valuethe value
Returns
False if the table key already exists with a different type

◆ PutStringArray()

static bool frc::SmartDashboard::PutStringArray ( wpi::StringRef  key,
wpi::ArrayRef< std::string >  value 
)
static

Put a string array in the table.

Parameters
keyThe key to be assigned to.
valueThe value that will be assigned.
Returns
False if the table key already exists with a different type

◆ PutValue()

static bool frc::SmartDashboard::PutValue ( wpi::StringRef  keyName,
std::shared_ptr< nt::Value value 
)
static

Maps the specified key to the specified complex value (such as an array) in this table.

The value can be retrieved by calling the RetrieveValue method with a key that is equal to the original key.

Parameters
keyNamethe key
valuethe value
Returns
False if the table key already exists with a different type

◆ SetDefaultBoolean()

static bool frc::SmartDashboard::SetDefaultBoolean ( wpi::StringRef  key,
bool  defaultValue 
)
static

Gets the current value in the table, setting it if it does not exist.

Parameters
keythe key
defaultValuethe default value to set if key doesn't exist.
Returns
False if the table key exists with a different type

◆ SetDefaultBooleanArray()

static bool frc::SmartDashboard::SetDefaultBooleanArray ( wpi::StringRef  key,
wpi::ArrayRef< int >  defaultValue 
)
static

Gets the current value in the table, setting it if it does not exist.

Parameters
keythe key
defaultValuethe default value to set if key doesn't exist.
Returns
False if the table key exists with a different type

◆ SetDefaultNumber()

static bool frc::SmartDashboard::SetDefaultNumber ( wpi::StringRef  key,
double  defaultValue 
)
static

Gets the current value in the table, setting it if it does not exist.

Parameters
keyThe key.
defaultValueThe default value to set if key doesn't exist.
Returns
False if the table key exists with a different type

◆ SetDefaultNumberArray()

static bool frc::SmartDashboard::SetDefaultNumberArray ( wpi::StringRef  key,
wpi::ArrayRef< double >  defaultValue 
)
static

Gets the current value in the table, setting it if it does not exist.

Parameters
keyThe key.
defaultValueThe default value to set if key doesn't exist.
Returns
False if the table key exists with a different type

◆ SetDefaultRaw()

static bool frc::SmartDashboard::SetDefaultRaw ( wpi::StringRef  key,
wpi::StringRef  defaultValue 
)
static

Gets the current value in the table, setting it if it does not exist.

Parameters
keyThe key.
defaultValueThe default value to set if key doesn't exist.
Returns
False if the table key exists with a different type

◆ SetDefaultString()

static bool frc::SmartDashboard::SetDefaultString ( wpi::StringRef  key,
wpi::StringRef  defaultValue 
)
static

Gets the current value in the table, setting it if it does not exist.

Parameters
keythe key
defaultValuethe default value to set if key doesn't exist.
Returns
False if the table key exists with a different type

◆ SetDefaultStringArray()

static bool frc::SmartDashboard::SetDefaultStringArray ( wpi::StringRef  key,
wpi::ArrayRef< std::string >  defaultValue 
)
static

Gets the current value in the table, setting it if it does not exist.

Parameters
keyThe key.
defaultValueThe default value to set if key doesn't exist.
Returns
False if the table key exists with a different type

◆ SetDefaultValue()

static bool frc::SmartDashboard::SetDefaultValue ( wpi::StringRef  key,
std::shared_ptr< nt::Value defaultValue 
)
static

Gets the current value in the table, setting it if it does not exist.

Parameters
keythe key
defaultValueThe default value to set if key doesn't exist.
Returns
False if the table key exists with a different type

◆ SetFlags()

static void frc::SmartDashboard::SetFlags ( wpi::StringRef  key,
unsigned int  flags 
)
static

Sets flags on the specified key in this table.

The key can not be null.

Parameters
keythe key name
flagsthe flags to set (bitmask)

◆ SetPersistent()

static void frc::SmartDashboard::SetPersistent ( wpi::StringRef  key)
static

Makes a key's value persistent through program restarts.

Parameters
keythe key to make persistent

The documentation for this class was generated from the following file: