Allow URRobot to be used as a context object.
This commit is contained in:
parent
47c29fab83
commit
606ecd5fa3
@ -365,11 +365,3 @@ class Robot(URRobot):
|
|||||||
t = m3d.Transform()
|
t = m3d.Transform()
|
||||||
t.orient.rotate_zb(val)
|
t.orient.rotate_zb(val)
|
||||||
self.add_pose_tool(t)
|
self.add_pose_tool(t)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class URRobot(object):
|
|||||||
self.rtmon = self.get_realtime_monitor()
|
self.rtmon = self.get_realtime_monitor()
|
||||||
# precision of joint movem used to wait for move completion
|
# precision of joint movem used to wait for move completion
|
||||||
# the value must be conservative! otherwise we may wait forever
|
# the value must be conservative! otherwise we may wait forever
|
||||||
self.joinEpsilon = 0.01
|
self.joinEpsilon = 0.01
|
||||||
# It seems URScript is limited in the character length of floats it accepts
|
# It seems URScript is limited in the character length of floats it accepts
|
||||||
self.max_float_length = 6 # FIXME: check max length!!!
|
self.max_float_length = 6 # FIXME: check max length!!!
|
||||||
|
|
||||||
@ -54,6 +54,12 @@ class URRobot(object):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.__repr__()
|
return self.__repr__()
|
||||||
|
|
||||||
|
def __enter__(self):
|
||||||
|
return self
|
||||||
|
|
||||||
|
def __exit__(self, exc_type, exc_value, traceback):
|
||||||
|
self.close()
|
||||||
|
|
||||||
def is_running(self):
|
def is_running(self):
|
||||||
"""
|
"""
|
||||||
Return True if robot is running (not
|
Return True if robot is running (not
|
||||||
@ -235,8 +241,8 @@ class URRobot(object):
|
|||||||
dist += (target[i] - pose[i]) ** 2
|
dist += (target[i] - pose[i]) ** 2
|
||||||
for i in range(3, 6):
|
for i in range(3, 6):
|
||||||
dist += ((target[i] - pose[i]) / 5) ** 2 # arbitraty length like
|
dist += ((target[i] - pose[i]) / 5) ** 2 # arbitraty length like
|
||||||
return dist ** 0.5
|
return dist ** 0.5
|
||||||
|
|
||||||
def _get_joints_dist(self, target):
|
def _get_joints_dist(self, target):
|
||||||
joints = self.getj(wait=True)
|
joints = self.getj(wait=True)
|
||||||
dist = 0
|
dist = 0
|
||||||
@ -432,6 +438,3 @@ class URRobot(object):
|
|||||||
Move down in csys z
|
Move down in csys z
|
||||||
"""
|
"""
|
||||||
self.up(-z, acc, vel)
|
self.up(-z, acc, vel)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -252,5 +252,3 @@ class URRTMonitor(threading.Thread):
|
|||||||
while not self._stop_event:
|
while not self._stop_event:
|
||||||
self.__recv_rt_data()
|
self.__recv_rt_data()
|
||||||
self._rtSock.close()
|
self._rtSock.close()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user