SmartDashboard

class wpilib.SmartDashboard[source]

Bases: object

The bridge between robot programs and the SmartDashboard on the laptop

When a value is put into the SmartDashboard, it pops up on the SmartDashboard on the remote host. Users can put values into and get values from the SmartDashboard.

These values can also be accessed by a NetworkTables client via the ‘SmartDashboard’ table:

from networktables import NetworkTables
sd = NetworkTables.getTable('SmartDashboard')

# sd.putXXX and sd.getXXX work as expected here
classmethod clearFlags(key, flags)[source]

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)
classmethod clearPersistent(key)[source]

Stop making a key’s value persistent through program restarts. The key cannot be null.

Parameters:key – the key name
classmethod containsKey(key)[source]

Checks the table and tells if it contains the specified key.

Parameters:key – key the key to search for
Returns:true if the table as a value assigned to the given key
classmethod delete(key)[source]

Deletes the specified key in this table. The key can not be null.

Parameters:key – the key name
classmethod getBoolean(key, defaultValue)[source]

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

Parameters:
  • key (str) – the key to look up
  • defaultValue – returned if the key doesn’t exist
Returns:

the value associated with the given key or the given default value if there is no value associated with the key

classmethod getBooleanArray(key, defaultValue)[source]

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 (str) – the key to look up
  • defaultValue – returned if the key doesn’t exist
Returns:

the value associated with the given key or the given default value if there is no value associated with the key

classmethod getData(key)[source]

Returns the value at the specified key.

Parameters:key (str) – the key
Returns:the value
Raises:KeyError if the key doesn’t exist
classmethod getEntry(key)[source]

Gets the entry for the specified key.

Parameters:key – the key name
Return type:NetworkTableEntry
classmethod getFlags(key)[source]

Returns the flags for the specified key.

Parameters:key – the key name
Returns:the flags, or 0 if the key is not defined
classmethod getKeys(types=0)[source]

Get the keys stored in the SmartDashboard table of NetworkTables.

Parameters:types – bitmask of types; 0 is treated as a “don’t care”.
Returns:keys currently in the table
classmethod getNumber(key, defaultValue)[source]

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

Parameters:
  • key (str) – the key to look up
  • defaultValue – returned if the key doesn’t exist
Returns:

the value associated with the given key or the given default value if there is no value associated with the key

classmethod getNumberArray(key, defaultValue)[source]

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 (str) – the key to look up
  • defaultValue – returned if the key doesn’t exist
Returns:

the value associated with the given key or the given default value if there is no value associated with the key

classmethod getRaw(key, defaultValue)[source]

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 (str) – the key to look up
  • defaultValue – returned if the key doesn’t exist
Returns:

the value associated with the given key or the given default value if there is no value associated with the key

classmethod getString(key, defaultValue)[source]

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

Parameters:
  • key (str) – the key to look up
  • defaultValue – returned if the key doesn’t exist
Returns:

the value associated with the given key or the given default value if there is no value associated with the key

classmethod getStringArray(key, defaultValue)[source]

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 (str) – the key to look up
  • defaultValue (list(str)) – 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

Return type:

list(str)

classmethod getTable()[source]
classmethod isPersistent(key)[source]

Returns whether the value is persistent through program restarts. The key cannot be null.

Parameters:key – the key name
Returns:True if the value is persistent.
mutex = <unlocked _thread.RLock object owner=0 count=0>
classmethod putBoolean(key, value)[source]

Put a boolean in the table.

Parameters:
  • key – the key to be assigned to
  • value – the value that will be assigned

:return False if the table key already exists with a different type

classmethod putBooleanArray(key, value)[source]

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

classmethod putData(*args, **kwargs)[source]

Maps the specified key (name of the Sendable if not provided) 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.

Two argument formats are supported:

  • key, data
  • value
Parameters:
  • key (str) – the key (cannot be None)
  • data (Sendable) – the value
  • value (Sendable) – the value
classmethod putNumber(key, value)[source]

Put a number 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

classmethod putNumberArray(key, value)[source]

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

classmethod putRaw(key, value)[source]

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

classmethod putString(key, value)[source]

Put a string 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

classmethod putStringArray(key, value)[source]

Put a string array in the table

Parameters:
  • key (str) – the key to be assigned to
  • value (list(str)) – the value that will be assigned
Returns:

False if the table key already exists with a different type

Return type:

bool

classmethod setDefaultBoolean(key, defaultValue)[source]

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 doens’t exist.
Returns:

False if the table key exists with a different type

classmethod setDefaultBooleanArray(key, defaultValue)[source]

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 doens’t exist.
Returns:

False if the table key exists with a different type

classmethod setDefaultNumber(key, defaultValue)[source]

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 doens’t exist.
Returns:

False if the table key exists with a different type

classmethod setDefaultNumberArray(key, defaultValue)[source]

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 doens’t exist.
Returns:

False if the table key exists with a different type

classmethod setDefaultRaw(key, defaultValue)[source]

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 doens’t exist.
Returns:

False if the table key exists with a different type

classmethod setDefaultString(key, defaultValue)[source]

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 doens’t exist.
Returns:

False if the table key exists with a different type

classmethod setDefaultStringArray(key, defaultValue)[source]

If the key doesn’t currently exist, then the specified value will be assigned to the key.

Parameters:
  • key (str) – the key to be assigned to
  • defaultValue (list(str)) – the default value to set if key doesn’t exist.
Returns:

False if the table key exists with a different type

Return type:

bool

classmethod setFlags(key, flags)[source]

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)
classmethod setPersistent(key)[source]

Makes a key’s value persistent through program restarts. The key cannot be null.

Parameters:key – the key name
table = None
tablesToData = {}
classmethod updateValues()[source]