Allow URRobot to be used as a context object.

This commit is contained in:
Chris Gilmer 2017-01-24 12:55:04 -08:00 committed by ORD
parent 47c29fab83
commit 606ecd5fa3
3 changed files with 9 additions and 16 deletions

View File

@ -365,11 +365,3 @@ class Robot(URRobot):
t = m3d.Transform()
t.orient.rotate_zb(val)
self.add_pose_tool(t)

View File

@ -54,6 +54,12 @@ class URRobot(object):
def __str__(self):
return self.__repr__()
def __enter__(self):
return self
def __exit__(self, exc_type, exc_value, traceback):
self.close()
def is_running(self):
"""
Return True if robot is running (not
@ -432,6 +438,3 @@ class URRobot(object):
Move down in csys z
"""
self.up(-z, acc, vel)

View File

@ -252,5 +252,3 @@ class URRTMonitor(threading.Thread):
while not self._stop_event:
self.__recv_rt_data()
self._rtSock.close()