SmartDashboard
- class wpilib.SmartDashboard
Bases:
pybind11_object
- 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 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 return 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) ntcore._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 getKeys(types: SupportsInt = 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 return 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 return 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) ntcore._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[SupportsInt]) 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: SupportsFloat) 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[SupportsFloat]) 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: Buffer) 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: ntcore._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
Set the value in the table if key does not exist
- Parameters:
key – the key
defaultValue – the value to set if key doesn’t exist.
- Returns:
True if the table key did not already exist, otherwise False
- static setDefaultBooleanArray(key: str, defaultValue: List[SupportsInt]) bool
Set the value in the table if key does not exist.
- Parameters:
key – the key
defaultValue – the value to set if key doesn’t exist.
- Returns:
True if the table key did not already exist, otherwise False
- static setDefaultNumber(key: str, defaultValue: SupportsFloat) bool
Set the value in the table if key does not exist.
- Parameters:
key – The key.
defaultValue – The value to set if key doesn’t exist.
- Returns:
True if the table key did not already exist, otherwise False
- static setDefaultNumberArray(key: str, defaultValue: List[SupportsFloat]) bool
Set the value in the table if key does not exist.
- Parameters:
key – The key.
defaultValue – The value to set if key doesn’t exist.
- Returns:
True if the table key did not already exist, otherwise False
- static setDefaultRaw(key: str, defaultValue: Buffer) bool
Set the value in the table if key does not exist.
- Parameters:
key – The key.
defaultValue – The value to set if key doesn’t exist.
- Returns:
True if the table key did not already exist, otherwise False
- static setDefaultString(key: str, defaultValue: str) bool
Set the value in the table if key does not exist.
- Parameters:
key – the key
defaultValue – the value to set if key doesn’t exist.
- Returns:
True if the table key did not already exist, otherwise False
- static setDefaultStringArray(key: str, defaultValue: List[str]) bool
Set the value in the table if key does not exist.
- Parameters:
key – The key.
defaultValue – The value to set if key doesn’t exist.
- Returns:
True if the table key did not already exist, otherwise False
- static setDefaultValue(key: str, defaultValue: ntcore._ntcore.Value) bool
Set the value in the table if key does not exist.
- Parameters:
key – the key
defaultValue – The value to set if key doesn’t exist.
- Returns:
True if the table key did not already exist, otherwise False
- 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.