SmartDashboard¶
- class wpilib.SmartDashboard¶
Bases:
pybind11_builtins.pybind11_object
- static clearFlags(key: str, flags: int) None ¶
Clears flags on the specified key in this table. The key can not be null.
- Parameters
key – the key name
flags – the flags to clear (bitmask)
- static clearPersistent(key: str) None ¶
Stop making a key’s value persistent through program restarts. The key cannot be null.
- Parameters
key – the key name
- static containsKey(key: str) bool ¶
Determines whether the given key is in this table.
- Parameters
key – the key to search for
- Returns
true if the table as a value assigned to the given key
- static delete(key: str) None ¶
Deletes the specified key in this table.
- Parameters
key – the key name
- static getBoolean(keyName: str, defaultValue: object) object ¶
Returns the value at the specified key.
If the key is not found, returns the default value.
- Parameters
keyName – the key
defaultValue – the default value to set if key doesn’t exist
- Returns
the value
- static getBooleanArray(key: str, defaultValue: object) object ¶
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
key – The key to look up.
defaultValue – The 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.
@note 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.
- static getData(keyName: str) wpiutil._wpiutil.Sendable ¶
Returns the value at the specified key.
- Parameters
keyName – the key
- Returns
the value
- static getEntry(key: str) _pyntcore._ntcore.NetworkTableEntry ¶
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
key – the key
- Returns
the entry for the key
- static getFlags(key: str) int ¶
Returns the flags for the specified key.
- Parameters
key – the key name
- Returns
the flags, or 0 if the key is not defined
- static getKeys(types: int = 0) List[str] ¶
- Parameters
types – bitmask of types; 0 is treated as a “don’t care”.
- Returns
keys currently in the table
- static getNumber(keyName: str, defaultValue: object) object ¶
Returns the value at the specified key.
If the key is not found, returns the default value.
- Parameters
keyName – the key
defaultValue – the default value to set if the key doesn’t exist
- Returns
the value
- static getNumberArray(key: str, defaultValue: object) object ¶
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
key – The key to look up.
defaultValue – The 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.
- static getRaw(key: str, defaultValue: object) object ¶
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
key – The key to look up.
defaultValue – The 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.
- static getString(keyName: str, defaultValue: object) object ¶
Returns the value at the specified key.
If the key is not found, returns the default value.
- Parameters
keyName – the key
defaultValue – the default value to set if the key doesn’t exist
- Returns
the value
- static getStringArray(key: str, defaultValue: object) object ¶
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
key – The key to look up.
defaultValue – The 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.
- static getValue(keyName: str) _pyntcore._ntcore.Value ¶
Retrieves the complex value (such as an array) in this table into the complex data object.
- Parameters
keyName – the key
- static init() None ¶
- static isPersistent(key: str) bool ¶
Returns whether the value is persistent through program restarts. The key cannot be null.
- Parameters
key – the key name
- static postListenerTask(task: Callable[[], None]) None ¶
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 updateValues().
- Parameters
task – The task to run synchronously from the main thread.
- static putBoolean(keyName: str, value: bool) bool ¶
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
keyName – the key
value – the value
- Returns
False if the table key already exists with a different type
- static putBooleanArray(key: str, value: List[int]) bool ¶
Put a boolean array in the table.
- Parameters
key – the key to be assigned to
value – the 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.
- static putData(*args, **kwargs)¶
Overloaded function.
putData(key: str, data: wpiutil._wpiutil.Sendable) -> None
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
key – the key
data – the value
putData(value: wpiutil._wpiutil.Sendable) -> None
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
value – the value
- static putNumber(keyName: str, value: float) bool ¶
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
keyName – the key
value – the value
- Returns
False if the table key already exists with a different type
- static putNumberArray(key: str, value: List[float]) bool ¶
Put a number array in the table.
- Parameters
key – The key to be assigned to.
value – The value that will be assigned.
- Returns
False if the table key already exists with a different type
- static putRaw(key: str, value: str) bool ¶
Put a raw value (byte array) in the table.
- Parameters
key – The key to be assigned to.
value – The value that will be assigned.
- Returns
False if the table key already exists with a different type
- static putString(keyName: str, value: str) bool ¶
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
keyName – the key
value – the value
- Returns
False if the table key already exists with a different type
- static putStringArray(key: str, value: List[str]) bool ¶
Put a string array in the table.
- Parameters
key – The key to be assigned to.
value – The value that will be assigned.
- Returns
False if the table key already exists with a different type
- static putValue(keyName: str, value: _pyntcore._ntcore.Value) bool ¶
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
keyName – the key
value – the value
- Returns
False if the table key already exists with a different type
- static setDefaultBoolean(key: str, defaultValue: bool) bool ¶
Gets the current value in the table, setting it if it does not exist.
- Parameters
key – the key
defaultValue – the default value to set if key doesn’t exist.
- Returns
False if the table key exists with a different type
- static setDefaultBooleanArray(key: str, defaultValue: List[int]) bool ¶
Gets the current value in the table, setting it if it does not exist.
- Parameters
key – the key
defaultValue – the default value to set if key doesn’t exist.
- Returns
False if the table key exists with a different type
- static setDefaultNumber(key: str, defaultValue: float) bool ¶
Gets the current value in the table, setting it if it does not exist.
- Parameters
key – The key.
defaultValue – The default value to set if key doesn’t exist.
- Returns
False if the table key exists with a different type
- static setDefaultNumberArray(key: str, defaultValue: List[float]) bool ¶
Gets the current value in the table, setting it if it does not exist.
- Parameters
key – The key.
defaultValue – The default value to set if key doesn’t exist.
- Returns
False if the table key exists with a different type
- static setDefaultRaw(key: str, defaultValue: str) bool ¶
Gets the current value in the table, setting it if it does not exist.
- Parameters
key – The key.
defaultValue – The default value to set if key doesn’t exist.
- Returns
False if the table key exists with a different type
- static setDefaultString(key: str, defaultValue: str) bool ¶
Gets the current value in the table, setting it if it does not exist.
- Parameters
key – the key
defaultValue – the default value to set if key doesn’t exist.
- Returns
False if the table key exists with a different type
- static setDefaultStringArray(key: str, defaultValue: List[str]) bool ¶
Gets the current value in the table, setting it if it does not exist.
- Parameters
key – The key.
defaultValue – The default value to set if key doesn’t exist.
- Returns
False if the table key exists with a different type
- static setDefaultValue(key: str, defaultValue: _pyntcore._ntcore.Value) bool ¶
Gets the current value in the table, setting it if it does not exist.
- Parameters
key – the key
defaultValue – The default value to set if key doesn’t exist.
- Returns
False if the table key exists with a different type
- static setFlags(key: str, flags: int) None ¶
Sets flags on the specified key in this table. The key can not be null.
- Parameters
key – the key name
flags – the flags to set (bitmask)
- static setPersistent(key: str) None ¶
Makes a key’s value persistent through program restarts.
- Parameters
key – the key to make persistent
- static updateValues() None ¶
Puts all sendable data to the dashboard.