forked from andyzeng/visual-pushing-grasping
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGet_robot_info.py
More file actions
39 lines (34 loc) · 1.1 KB
/
Get_robot_info.py
File metadata and controls
39 lines (34 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import sys
import asyncio
import time
import techmanpy
from techmanpy import TechmanException
import numpy as np
import xmltodict
xml_file = "./arm_data.xml"
with open(xml_file,encoding="UTF8") as fd:
data = xmltodict.parse(fd.read())
settings = data["File"]["CodeTable"]["Setting"]
num = 0
var_list = list()
for var in settings:
var_list.append(var["@Item"])
#print(var_list)
info = ["Coord_Robot_Tool"] # add desired variables
async def get_info(robotip):
""" while True: """
async with techmanpy.connect_svr(robot_ip=robotip,client_id="info") as conn:
value = await conn.get_values(info )
for i in range(len(info )):
print(f'{info [i]}:{value[info [i]]}')
""" # Sleep 2 seconds (at most)
time.sleep(2)
await conn.keep_alive() """
if __name__ == '__main__':
if len(sys.argv) == 2:
try:
asyncio.run(get_info(sys.argv[1]))
except KeyboardInterrupt:
print("Error") # terminate gracefully
else:
print(f'usage: {sys.argv[0]} <robot IP address>')