GenericSubscriber
- class ntcore.GenericSubscriber
Bases:
Subscriber
NetworkTables generic subscriber.
- get() ntcore._ntcore.Value
Get the last published value. If no value has been published, returns a value with unassigned type.
- Returns:
value
- getBoolean(defaultValue: bool) bool
Gets the entry’s value as a boolean. If the entry does not exist or is of different type, it will return the default value.
- Parameters:
defaultValue – the value to be returned if no value is found
- Returns:
the entry’s value or the given default value
- getBooleanArray(defaultValue: List[int]) List[int]
Gets the entry’s value as a boolean array. If the entry does not exist or is of different type, it will return the default value.
- Parameters:
defaultValue – the value to be returned if no value is found
- Returns:
the entry’s value or the given default value
@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.
- getDouble(defaultValue: float) float
Gets the entry’s value as a double. If the entry does not exist or is of different type, it will return the default value.
- Parameters:
defaultValue – the value to be returned if no value is found
- Returns:
the entry’s value or the given default value
- getDoubleArray(defaultValue: List[float]) List[float]
Gets the entry’s value as a double array. If the entry does not exist or is of different type, it will return the default value.
- Parameters:
defaultValue – the value to be returned if no value is found
- Returns:
the entry’s value or the given default value
@note This makes a copy of the array. If the overhead of this is a concern, use GetValue() instead.
- getFloat(defaultValue: float) float
Gets the entry’s value as a float. If the entry does not exist or is of different type, it will return the default value.
- Parameters:
defaultValue – the value to be returned if no value is found
- Returns:
the entry’s value or the given default value
- getFloatArray(defaultValue: List[float]) List[float]
Gets the entry’s value as a float array. If the entry does not exist or is of different type, it will return the default value.
- Parameters:
defaultValue – the value to be returned if no value is found
- Returns:
the entry’s value or the given default value
@note This makes a copy of the array. If the overhead of this is a concern, use GetValue() instead.
- getInteger(defaultValue: int) int
Gets the entry’s value as a integer. If the entry does not exist or is of different type, it will return the default value.
- Parameters:
defaultValue – the value to be returned if no value is found
- Returns:
the entry’s value or the given default value
- getIntegerArray(defaultValue: List[int]) List[int]
Gets the entry’s value as a integer array. If the entry does not exist or is of different type, it will return the default value.
- Parameters:
defaultValue – the value to be returned if no value is found
- Returns:
the entry’s value or the given default value
@note This makes a copy of the array. If the overhead of this is a concern, use GetValue() instead.
- getRaw(defaultValue: buffer) List[int]
Gets the entry’s value as a raw. If the entry does not exist or is of different type, it will return the default value.
- Parameters:
defaultValue – the value to be returned if no value is found
- Returns:
the entry’s value or the given default value
- getString(defaultValue: str) str
Gets the entry’s value as a string. If the entry does not exist or is of different type, it will return the default value.
- Parameters:
defaultValue – the value to be returned if no value is found
- Returns:
the entry’s value or the given default value
- getStringArray(defaultValue: List[str]) List[str]
Gets the entry’s value as a string array. If the entry does not exist or is of different type, it will return the default value.
- Parameters:
defaultValue – the value to be returned if no value is found
- Returns:
the entry’s value or the given default value
@note This makes a copy of the array. If the overhead of this is a concern, use GetValue() instead.
- getTopic() ntcore._ntcore.Topic
Get the corresponding topic.
- Returns:
Topic
- readQueue() List[ntcore._ntcore.Value]
Get an array of all value changes since the last call to ReadQueue. Also provides a timestamp for each value.
@note The “poll storage” subscribe option can be used to set the queue depth.
- Returns:
Array of timestamped values; empty array if no new changes have been published since the previous call.