DoubleTopic
- class ntcore.DoubleTopic(topic: ntcore._ntcore.Topic)
Bases:
Topic
NetworkTables Double topic.
Construct from a generic topic.
- Parameters:
topic – Topic
- close() None
Destroys the topic
- getEntry(defaultValue: typing.SupportsFloat, options: ntcore._ntcore.PubSubOptions = <ntcore._ntcore.PubSubOptions object at 0x725cfc152370>) ntcore._ntcore.DoubleEntry
Create a new entry for the topic.
Entries act as a combination of a subscriber and a weak publisher. The subscriber is active as long as the entry is not destroyed. The publisher is created when the entry is first written to, and remains active until either Unpublish() is called or the entry is destroyed.
Note
It is not possible to use two different data types with the same topic. Conflicts between publishers are typically resolved by the server on a first-come, first-served basis. Any published values that do not match the topic’s data type are dropped (ignored), and the entry will show no new values if the data type does not match. To determine if the data type matches, use the appropriate Topic functions.
- Parameters:
defaultValue – default value used when a default is not provided to a getter function
options – publish and/or subscribe options
- Returns:
entry
- getEntryEx(typeString: str, defaultValue: typing.SupportsFloat, options: ntcore._ntcore.PubSubOptions = <ntcore._ntcore.PubSubOptions object at 0x725cfc1a2430>) ntcore._ntcore.DoubleEntry
Create a new entry for the topic, with specific type string.
Entries act as a combination of a subscriber and a weak publisher. The subscriber is active as long as the entry is not destroyed. The publisher is created when the entry is first written to, and remains active until either Unpublish() is called or the entry is destroyed.
Note
It is not possible to use two different data types with the same topic. Conflicts between publishers are typically resolved by the server on a first-come, first-served basis. Any published values that do not match the topic’s data type are dropped (ignored), and the entry will show no new values if the data type does not match. To determine if the data type matches, use the appropriate Topic functions.
- Parameters:
typeString – type string
defaultValue – default value used when a default is not provided to a getter function
options – publish and/or subscribe options
- Returns:
entry
- kTypeString = 'double'
- publish(options: ntcore._ntcore.PubSubOptions = <ntcore._ntcore.PubSubOptions object at 0x725cfc198bb0>) ntcore._ntcore.DoublePublisher
Create a new publisher to the topic.
The publisher is only active as long as the returned object is not destroyed.
Note
It is not possible to publish two different data types to the same topic. Conflicts between publishers are typically resolved by the server on a first-come, first-served basis. Any published values that do not match the topic’s data type are dropped (ignored). To determine if the data type matches, use the appropriate Topic functions.
- Parameters:
options – publish options
- Returns:
publisher
- publishEx(typeString: str, properties: wpiutil.json, options: ntcore._ntcore.PubSubOptions = <ntcore._ntcore.PubSubOptions object at 0x725cfc1e34f0>) ntcore._ntcore.DoublePublisher
Create a new publisher to the topic, with type string and initial properties.
The publisher is only active as long as the returned object is not destroyed.
Note
It is not possible to publish two different data types to the same topic. Conflicts between publishers are typically resolved by the server on a first-come, first-served basis. Any published values that do not match the topic’s data type are dropped (ignored). To determine if the data type matches, use the appropriate Topic functions.
- Parameters:
typeString – type string
properties – JSON properties
options – publish options
- Returns:
publisher
- subscribe(defaultValue: typing.SupportsFloat, options: ntcore._ntcore.PubSubOptions = <ntcore._ntcore.PubSubOptions object at 0x725cfc3d8830>) ntcore._ntcore.DoubleSubscriber
Create a new subscriber to the topic.
The subscriber is only active as long as the returned object is not destroyed.
Note
Subscribers that do not match the published data type do not return any values. To determine if the data type matches, use the appropriate Topic functions.
- Parameters:
defaultValue – default value used when a default is not provided to a getter function
options – subscribe options
- Returns:
subscriber
- subscribeEx(typeString: str, defaultValue: typing.SupportsFloat, options: ntcore._ntcore.PubSubOptions = <ntcore._ntcore.PubSubOptions object at 0x725cfc1be0f0>) ntcore._ntcore.DoubleSubscriber
Create a new subscriber to the topic, with specific type string.
The subscriber is only active as long as the returned object is not destroyed.
Note
Subscribers that do not match the published data type do not return any values. To determine if the data type matches, use the appropriate Topic functions.
- Parameters:
typeString – type string
defaultValue – default value used when a default is not provided to a getter function
options – subscribe options
- Returns:
subscriber