SmartDashboard
- class wpilib.SmartDashboard
Bases:
pybind11_object- static clear_persistent(key: str) None
Stop making a key’s value persistent through program restarts. The key cannot be null.
- Parameters:
key – the key name
- static contains_key(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 get_boolean(key_name: str, default_value: object) object
Returns the value at the specified key.
If the key is not found, returns the default value.
- Parameters:
key_name – the key
default_value – the default value to return if key doesn’t exist
- Returns:
the value
- static get_boolean_array(key: str, default_value: 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.
default_value – 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 get_data(key_name: str) wpiutil._wpiutil.Sendable
Returns the value at the specified key.
- Parameters:
key_name – the key
- Returns:
the value
- static get_entry(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 get_keys(types: SupportsInt | SupportsIndex = 0) list[str]
- Parameters:
types – bitmask of types; 0 is treated as a “don’t care”.
- Returns:
keys currently in the table
- static get_number(key_name: str, default_value: object) object
Returns the value at the specified key.
If the key is not found, returns the default value.
- Parameters:
key_name – the key
default_value – the default value to return if the key doesn’t exist
- Returns:
the value
- static get_number_array(key: str, default_value: 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.
default_value – 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 get_raw(key: str, default_value: 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.
default_value – 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 get_string(key_name: str, default_value: object) object
Returns the value at the specified key.
If the key is not found, returns the default value.
- Parameters:
key_name – the key
default_value – the default value to return if the key doesn’t exist
- Returns:
the value
- static get_string_array(key: str, default_value: 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.
default_value – 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 get_value(key_name: str) ntcore._ntcore.Value
Retrieves the complex value (such as an array) in this table into the complex data object.
- Parameters:
key_name – the key
- static init() None
- static is_persistent(key: str) bool
Returns whether the value is persistent through program restarts. The key cannot be null.
- Parameters:
key – the key name
- static post_listener_task(task: collections.abc.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 put_boolean(key_name: 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:
key_name – the key
value – the value
- Returns:
False if the table key already exists with a different type
- static put_boolean_array(key: str, value: List[SupportsInt | SupportsIndex]) 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 put_data(*args, **kwargs)
Overloaded function.
put_data(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
put_data(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 put_number(key_name: str, value: SupportsFloat | SupportsIndex) 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:
key_name – the key
value – the value
- Returns:
False if the table key already exists with a different type
- static put_number_array(key: str, value: List[SupportsFloat | SupportsIndex]) 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 put_raw(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 put_string(key_name: 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:
key_name – the key
value – the value
- Returns:
False if the table key already exists with a different type
- static put_string_array(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 put_value(key_name: 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:
key_name – the key
value – the value
- Returns:
False if the table key already exists with a different type
- static set_default_boolean(key: str, default_value: bool) bool
Set the value in the table if key does not exist
- Parameters:
key – the key
default_value – the value to set if key doesn’t exist.
- Returns:
True if the table key did not already exist, otherwise False
- static set_default_boolean_array(key: str, default_value: List[SupportsInt | SupportsIndex]) bool
Set the value in the table if key does not exist.
- Parameters:
key – the key
default_value – the value to set if key doesn’t exist.
- Returns:
True if the table key did not already exist, otherwise False
- static set_default_number(key: str, default_value: SupportsFloat | SupportsIndex) bool
Set the value in the table if key does not exist.
- Parameters:
key – The key.
default_value – The value to set if key doesn’t exist.
- Returns:
True if the table key did not already exist, otherwise False
- static set_default_number_array(key: str, default_value: List[SupportsFloat | SupportsIndex]) bool
Set the value in the table if key does not exist.
- Parameters:
key – The key.
default_value – The value to set if key doesn’t exist.
- Returns:
True if the table key did not already exist, otherwise False
- static set_default_raw(key: str, default_value: Buffer) bool
Set the value in the table if key does not exist.
- Parameters:
key – The key.
default_value – The value to set if key doesn’t exist.
- Returns:
True if the table key did not already exist, otherwise False
- static set_default_string(key: str, default_value: str) bool
Set the value in the table if key does not exist.
- Parameters:
key – the key
default_value – the value to set if key doesn’t exist.
- Returns:
True if the table key did not already exist, otherwise False
- static set_default_string_array(key: str, default_value: List[str]) bool
Set the value in the table if key does not exist.
- Parameters:
key – The key.
default_value – The value to set if key doesn’t exist.
- Returns:
True if the table key did not already exist, otherwise False
- static set_default_value(key: str, default_value: ntcore._ntcore.Value) bool
Set the value in the table if key does not exist.
- Parameters:
key – the key
default_value – The value to set if key doesn’t exist.
- Returns:
True if the table key did not already exist, otherwise False
- static set_persistent(key: str) None
Makes a key’s value persistent through program restarts.
- Parameters:
key – the key to make persistent
- static update_values() None
Puts all sendable data to the dashboard.