-
Notifications
You must be signed in to change notification settings - Fork 4
TMFlow Server
The TMFlow server makes it possible to query and update the internal parameters of the robot. Besides that, it broadcasts the full state configuration to all connected clients at a high frequency.
To see all available internal parameters, go to Settings > Connection > Ethernet Slave > Configuration
in TMFlow.
To setup a connection with the TMFlow server:
async with techmanpy.connect_svr(robot_ip, [client_id, conn_timeout]) as conn:
# connection established
...
-
robot_ip: str
| mandatory kwarg
The IP address of the robot -
client_id: str
| optional kwargs, default = 'SVRpy'
The used identifier of this client (use a custom value when using multiple clients at the same time) -
conn_timeout: int (s)
| optional kwarg, default = 3
The duration before a connection attempt times out
Given the connection object conn
, various actions can be performed. These will now be discussed.
To subscribe to the broadcast stream:
def on_params(params):
# broadcasted parameters received
...
conn.add_broadcast_callback(on_params)
await conn.keep_alive()
-
params: dict(str, obj)
| mandatory arg
The internal parameters that are broadcasted, along with their values. The values can be any ofstr
,int
,float
,bool
Don't forget to add await conn.keep_alive()
, otherwise the program will directly terminate.
To query a specific internal parameter:
robot_model = await conn.get_value(item)
-
item: str
| mandatory arg
The internal parameter that is queried
Returns the requested value, can be any of str
, int
, float
, bool
.
To query multiple internal parameters:
params = await conn.get_values(items)
-
items: set(str)
| mandatory arg
The internal parameters that are queried
Returns dict(str, obj)
containing the requested internal parameters along with their values. The returned values can be any of str
, int
, float
, bool
.
To set a specific internal parameter:
await conn.set_value(key, value)
-
key: str
| mandatory arg
The internal parameter name -
value: obj
| mandatory arg
Can be any ofstr
,int
,float
,bool
.
To set multiple internal parameters:
await conn.set_values(items)
-
items: dict(str, obj)
| mandatory arg
The internal parameters that must be set, along with their new values. The set values can be any ofstr
,int
,float
,bool
.