Note
Go to the end to download the full example code.
Nodes basics#
Showcases the basic pyaseba.client.Node interface.
from pyaseba.client import Node
pyaseba.client.Node are stateful objects linked to a
specific remote Aseba node connected through a pyaseba.client.Client.
node = Node(cached=False)
node.connect(target="tcp:port=33333")
node
<Node 0 on tcp:port=33333>
While most pyaseba.client.Client methods require selecting a node_id,
pyaseba.client.Node methods keep a reference to the node ID and network,
which can be used to, for example, set and get variables.
1
Nodes keep an optional cache of Aseba variables values.
node.get("value", cached=True)
1
node.set("value", 2, cached=True)
When caching, modified values are not sent to the remote node.
node.get("value", cached=False)
1
Until calling pyaseba.client.sync()
2
Closing the node will also close the client.
node.close(reset=True)
Total running time of the script: (0 minutes 1.014 seconds)