compas-rrc/compas_rrc

Add the possibility to wait_for_robot to connect

Opened this issue · 0 comments

Summary

As an RRC user, I want be able to send an instruction even before the robot has connected, and have the code wait until robot connection to execute it so that I can simplify the client code.

Details

Will this change the current API? How?
One option would be to have a method abb.wait_for_robot() so that client code could be:

ros = RosClient()
ros.run()

abb = AbbClient(ros,'/')
abb.wait_for_robot()
current_pose = abb.send_and_wait(GetFrame())

Additionally, wait_for_robot could take a timeout parameter, but not raise exceptions if it's expired, just like the wait methods of threading.Event, eg:

ros = RosClient()
ros.run()

abb = AbbClient(ros,'/')

while True:
   if not abb.wait_for_robot(timeout=10):
      print('Robot not connected, will retry...')
      continue

   current_pose = abb.send_and_wait(GetFrame())