-
Notifications
You must be signed in to change notification settings - Fork 1
VerseLayer
Instances of VerseLayer
are used for creating new layers at Verse server. Layers can be used for sharing arrays, sparse matrixes, vectores, etc. When other client creates layer in subscribed node, then instance of VerseLayer is automatically created and stored in dictionary node.layers
(key is id of layer).
New VerseLayer can be created using following code:
import vrsent
session = vrsent.VerseSession(hostname='localhost', service='12345', \
callback_thread=True, username='joe', password='pass')
node = vrsent.VerseNode(session, custom_type=100)
layer = vrsent.VerseLayer(node=node, \
parent_layer=None, \
data_type=vrs.VALUE_TYPE_UINT8, \
count=1,
custom_type=128)
When layer is created, then you can add items to the layer. Item of layer can be only tuple and tuple can contain max 4 values of int/float. You can add item to layer using following code:
layer.items[0] = (1.0, -1.0, 0.0)
Keep in mind that item of layer has to be tuple. When we want to have item only with one scalar value, then we has to use one item tuple:
other_layer.items[0] = (1.0,)
The layer.items
is subclass of dictionary. Assigning value to the item automatically sends value to the Verse server.
- https://gist.github.com/jirihnidek/fb3bbb23fbeae3ffbdb5
- This script tries to increment values of specific layer