wait_for_move method tested
This commit is contained in:
parent
8b910a5d42
commit
c60db50c43
17
urx/urx.py
17
urx/urx.py
@ -221,18 +221,18 @@ class URRobot(object):
|
|||||||
return self.getj()
|
return self.getj()
|
||||||
|
|
||||||
def wait_for_move(self):
|
def wait_for_move(self):
|
||||||
time.sleep(0.05)# it is important to sleep since robot may takes a while to get into running state
|
time.sleep(0.2)# it is important to sleep since robot may takes a while to get into running state
|
||||||
while True:
|
while True:
|
||||||
if not self.is_running():
|
if not self.is_running():
|
||||||
raise RobotException("Robot stopped")
|
raise RobotException("Robot stopped")
|
||||||
jts = self.secmon.get_joint_data(wait=True)
|
jts = self.secmon.get_joint_data(wait=True)
|
||||||
finished = True
|
finished = True
|
||||||
for i in range(0, 6):
|
for i in range(0, 6):
|
||||||
if abs(jts["q_actual%s"%i] - jts["q_targets%s"%i]) > self.radialEpsilon:
|
if abs(jts["q_actual%s"%i] - jts["q_target%s"%i]) > self.radialEpsilon:
|
||||||
finished = False
|
finished = False
|
||||||
break
|
break
|
||||||
if finished and not self.secmon.is_program_running():
|
if finished and not self.secmon.is_program_running():
|
||||||
return
|
return
|
||||||
|
|
||||||
def getj(self, wait=False):
|
def getj(self, wait=False):
|
||||||
"""
|
"""
|
||||||
@ -283,8 +283,6 @@ class URRobot(object):
|
|||||||
self.wait_for_move()
|
self.wait_for_move()
|
||||||
return self.getl()
|
return self.getl()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def movels(self, pose_list, acc, vel , radius, wait=True):
|
def movels(self, pose_list, acc, vel , radius, wait=True):
|
||||||
"""
|
"""
|
||||||
where pose_list is a list of pose.
|
where pose_list is a list of pose.
|
||||||
@ -307,11 +305,6 @@ class URRobot(object):
|
|||||||
self.wait_for_move()
|
self.wait_for_move()
|
||||||
return self.getl()
|
return self.getl()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def stopl(self, acc = 0.5):
|
def stopl(self, acc = 0.5):
|
||||||
self.send_program("stopl(%s)" % acc)
|
self.send_program("stopl(%s)" % acc)
|
||||||
|
|
||||||
@ -416,7 +409,7 @@ class Robot(URRobot):
|
|||||||
vel = self.default_linear_velocity
|
vel = self.default_linear_velocity
|
||||||
t = self.calibration * trans
|
t = self.calibration * trans
|
||||||
pose = URRobot.movel(self, t.pose_vector, acc, vel, wait)
|
pose = URRobot.movel(self, t.pose_vector, acc, vel, wait)
|
||||||
if pose: #movel does not return anything when wait is False
|
if pose != None : #movel does not return anything when wait is False
|
||||||
return self.inverse * math3d.Transform(pose)
|
return self.inverse * math3d.Transform(pose)
|
||||||
|
|
||||||
def add_transform_b(self, trans, acc=None, vel=None, wait=True):
|
def add_transform_b(self, trans, acc=None, vel=None, wait=True):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user