public class SmartDashboard extends Object
SmartDashboard
class is the bridge between robot programs and the SmartDashboard on
the laptop.
When a value is put into the SmartDashboard here, it pops up on the SmartDashboard on the laptop. Users can put values into and get values from the SmartDashboard.
Modifier and Type | Method and Description |
---|---|
static void |
clearFlags(String key,
int flags)
Clears flags on the specified key in this table.
|
static void |
clearPersistent(String key)
Stop making a key's value persistent through program restarts.
|
static boolean |
containsKey(String key)
Checks the table and tells if it contains the specified key.
|
static void |
delete(String key)
Deletes the specified key in this table.
|
static boolean |
getBoolean(String key,
boolean defaultValue)
Returns the boolean the key maps to.
|
static boolean[] |
getBooleanArray(String key,
boolean[] defaultValue)
Returns the boolean array the key maps to.
|
static Boolean[] |
getBooleanArray(String key,
Boolean[] defaultValue)
Returns the boolean array the key maps to.
|
static Sendable |
getData(String key)
Returns the value at the specified key.
|
static NetworkTableEntry |
getEntry(String key)
Gets the entry for the specified key.
|
static int |
getFlags(String key)
Returns the flags for the specified key.
|
static Set<String> |
getKeys()
Get the keys stored in the SmartDashboard table of NetworkTables.
|
static Set<String> |
getKeys(int types)
Get the keys stored in the SmartDashboard table of NetworkTables.
|
static double |
getNumber(String key,
double defaultValue)
Returns the number the key maps to.
|
static double[] |
getNumberArray(String key,
double[] defaultValue)
Returns the number array the key maps to.
|
static Double[] |
getNumberArray(String key,
Double[] defaultValue)
Returns the number array the key maps to.
|
static byte[] |
getRaw(String key,
byte[] defaultValue)
Returns the raw value (byte array) the key maps to.
|
static String |
getString(String key,
String defaultValue)
Returns the string the key maps to.
|
static String[] |
getStringArray(String key,
String[] defaultValue)
Returns the string array the key maps to.
|
static boolean |
isPersistent(String key)
Returns whether the value is persistent through program restarts.
|
static boolean |
putBoolean(String key,
boolean value)
Put a boolean in the table.
|
static boolean |
putBooleanArray(String key,
boolean[] value)
Put a boolean array in the table.
|
static boolean |
putBooleanArray(String key,
Boolean[] value)
Put a boolean array in the table.
|
static void |
putData(Sendable value)
Maps the specified key (where the key is the name of the
NamedSendable
to the specified value in this table. |
static void |
putData(String key,
Sendable data)
Maps the specified key to the specified value in this table.
|
static boolean |
putNumber(String key,
double value)
Put a number in the table.
|
static boolean |
putNumberArray(String key,
double[] value)
Put a number array in the table.
|
static boolean |
putNumberArray(String key,
Double[] value)
Put a number array in the table.
|
static boolean |
putRaw(String key,
byte[] value)
Put a raw value (byte array) in the table.
|
static boolean |
putRaw(String key,
ByteBuffer value,
int len)
Put a raw value (bytes from a byte buffer) in the table.
|
static boolean |
putString(String key,
String value)
Put a string in the table.
|
static boolean |
putStringArray(String key,
String[] value)
Put a string array in the table.
|
static boolean |
setDefaultBoolean(String key,
boolean defaultValue)
Gets the current value in the table, setting it if it does not exist.
|
static boolean |
setDefaultBooleanArray(String key,
boolean[] defaultValue)
Gets the current value in the table, setting it if it does not exist.
|
static boolean |
setDefaultBooleanArray(String key,
Boolean[] defaultValue)
Gets the current value in the table, setting it if it does not exist.
|
static boolean |
setDefaultNumber(String key,
double defaultValue)
Gets the current value in the table, setting it if it does not exist.
|
static boolean |
setDefaultNumberArray(String key,
double[] defaultValue)
Gets the current value in the table, setting it if it does not exist.
|
static boolean |
setDefaultNumberArray(String key,
Double[] defaultValue)
Gets the current value in the table, setting it if it does not exist.
|
static boolean |
setDefaultRaw(String key,
byte[] defaultValue)
Gets the current value in the table, setting it if it does not exist.
|
static boolean |
setDefaultString(String key,
String defaultValue)
Gets the current value in the table, setting it if it does not exist.
|
static boolean |
setDefaultStringArray(String key,
String[] defaultValue)
Gets the current value in the table, setting it if it does not exist.
|
static void |
setFlags(String key,
int flags)
Sets flags on the specified key in this table.
|
static void |
setPersistent(String key)
Makes a key's value persistent through program restarts.
|
static void |
updateValues()
Puts all sendable data to the dashboard.
|
public static void putData(String key, Sendable data)
key
- the keydata
- the valueIllegalArgumentException
- If key is nullpublic static void putData(Sendable value)
NamedSendable
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.value
- the valueIllegalArgumentException
- If key is nullpublic static Sendable getData(String key)
key
- the keyIllegalArgumentException
- if the key is nullpublic static NetworkTableEntry getEntry(String key)
key
- the key namepublic static boolean containsKey(String key)
key
- the key to search forpublic static Set<String> getKeys(int types)
types
- bitmask of types; 0 is treated as a "don't care".public static Set<String> getKeys()
public static void setPersistent(String key)
key
- the key namepublic static void clearPersistent(String key)
key
- the key namepublic static boolean isPersistent(String key)
key
- the key namepublic static void setFlags(String key, int flags)
key
- the key nameflags
- the flags to set (bitmask)public static void clearFlags(String key, int flags)
key
- the key nameflags
- the flags to clear (bitmask)public static int getFlags(String key)
key
- the key namepublic static void delete(String key)
key
- the key namepublic static boolean putBoolean(String key, boolean value)
key
- the key to be assigned tovalue
- the value that will be assignedpublic static boolean setDefaultBoolean(String key, boolean defaultValue)
key
- the keydefaultValue
- the default value to set if key does not exist.public static boolean getBoolean(String key, boolean defaultValue)
key
- the key to look updefaultValue
- the value to be returned if no value is foundpublic static boolean putNumber(String key, double value)
key
- the key to be assigned tovalue
- the value that will be assignedpublic static boolean setDefaultNumber(String key, double defaultValue)
key
- the keydefaultValue
- the default value to set if key does not exist.public static double getNumber(String key, double defaultValue)
key
- the key to look updefaultValue
- the value to be returned if no value is foundpublic static boolean putString(String key, String value)
key
- the key to be assigned tovalue
- the value that will be assignedpublic static boolean setDefaultString(String key, String defaultValue)
key
- the keydefaultValue
- the default value to set if key does not exist.public static String getString(String key, String defaultValue)
key
- the key to look updefaultValue
- the value to be returned if no value is foundpublic static boolean putBooleanArray(String key, boolean[] value)
key
- the key to be assigned tovalue
- the value that will be assignedpublic static boolean putBooleanArray(String key, Boolean[] value)
key
- the key to be assigned tovalue
- the value that will be assignedpublic static boolean setDefaultBooleanArray(String key, boolean[] defaultValue)
key
- the keydefaultValue
- the default value to set if key does not exist.public static boolean setDefaultBooleanArray(String key, Boolean[] defaultValue)
key
- the keydefaultValue
- the default value to set if key does not exist.public static boolean[] getBooleanArray(String key, boolean[] defaultValue)
key
- the key to look updefaultValue
- the value to be returned if no value is foundpublic static Boolean[] getBooleanArray(String key, Boolean[] defaultValue)
key
- the key to look updefaultValue
- the value to be returned if no value is foundpublic static boolean putNumberArray(String key, double[] value)
key
- the key to be assigned tovalue
- the value that will be assignedpublic static boolean putNumberArray(String key, Double[] value)
key
- the key to be assigned tovalue
- the value that will be assignedpublic static boolean setDefaultNumberArray(String key, double[] defaultValue)
key
- the keydefaultValue
- the default value to set if key does not exist.public static boolean setDefaultNumberArray(String key, Double[] defaultValue)
key
- the keydefaultValue
- the default value to set if key does not exist.public static double[] getNumberArray(String key, double[] defaultValue)
key
- the key to look updefaultValue
- the value to be returned if no value is foundpublic static Double[] getNumberArray(String key, Double[] defaultValue)
key
- the key to look updefaultValue
- the value to be returned if no value is foundpublic static boolean putStringArray(String key, String[] value)
key
- the key to be assigned tovalue
- the value that will be assignedpublic static boolean setDefaultStringArray(String key, String[] defaultValue)
key
- the keydefaultValue
- the default value to set if key does not exist.public static String[] getStringArray(String key, String[] defaultValue)
key
- the key to look updefaultValue
- the value to be returned if no value is foundpublic static boolean putRaw(String key, byte[] value)
key
- the key to be assigned tovalue
- the value that will be assignedpublic static boolean putRaw(String key, ByteBuffer value, int len)
key
- the key to be assigned tovalue
- the value that will be assignedlen
- the length of the valuepublic static boolean setDefaultRaw(String key, byte[] defaultValue)
key
- the keydefaultValue
- the default value to set if key does not exist.public static byte[] getRaw(String key, byte[] defaultValue)
key
- the key to look updefaultValue
- the value to be returned if no value is foundpublic static void updateValues()