Hey Anders,
Add this to your api:
def GetPose(self):
"""
Get position of the robot in XYZR
"""
string = "GetPose()"
self.send_data(string)
return self.wait_reply()
This will give you the pose (with a big delay) when you call it.
Otherwise this example gives you instantaneous update:
def get_feed(feed: DobotApi):
global current_actual
hasRead = 0
while True:
data = bytes()
while hasRead < 1440:
temp = feed.socket_dobot.recv(1440 - hasRead)
if len(temp) > 0:
hasRead += len(temp)
data += temp
hasRead = 0
a = np.frombuffer(data, dtype=MyType)
if hex((a['test_value'][0])) == '0x123456789abcdef':
# Refresh Properties
current_actual = a["tool_vector_actual"][0]
#print("tool_vector_actual:", current_actual)
print(current_actual)
sleep(0.001)