Untested: Make movexs take sequences of the same lengths as the pose_list argument for the speeds and blend radii.
This commit is contained in:
parent
a05418eb97
commit
8b8252b6ba
@ -5,6 +5,8 @@ http://support.universal-robots.com/URRobot/RemoteAccess
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
import number
|
||||||
|
import collections
|
||||||
|
|
||||||
from urx import urrtmon
|
from urx import urrtmon
|
||||||
from urx import ursecmon
|
from urx import ursecmon
|
||||||
@ -340,16 +342,19 @@ class URRobot(object):
|
|||||||
self._wait_for_move(pose_to, threshold=threshold)
|
self._wait_for_move(pose_to, threshold=threshold)
|
||||||
return self.getl()
|
return self.getl()
|
||||||
|
|
||||||
def movels(self, pose_list, acc=0.01, vel=0.01, radius=0.01, wait=True, threshold=None):
|
def movels(self, pose_list, acc=0.01, vel=0.01, radius=0.01,
|
||||||
|
wait=True, threshold=None):
|
||||||
"""
|
"""
|
||||||
Concatenate several movel commands and applies a blending radius
|
Concatenate several movel commands and applies a blending radius
|
||||||
pose_list is a list of pose.
|
pose_list is a list of pose.
|
||||||
This method is usefull since any new command from python
|
This method is usefull since any new command from python
|
||||||
to robot make the robot stop
|
to robot make the robot stop
|
||||||
"""
|
"""
|
||||||
return self.movexs("movel", pose_list, acc, vel, radius, wait, threshold=threshold)
|
return self.movexs("movel", pose_list, acc, vel, radius,
|
||||||
|
wait, threshold=threshold)
|
||||||
|
|
||||||
def movexs(self, command, pose_list, acc=0.01, vel=0.01, radius=0.01, wait=True, threshold=None):
|
def movexs(self, command, pose_list, acc=0.01, vel=0.01, radius=0.01,
|
||||||
|
wait=True, threshold=None):
|
||||||
"""
|
"""
|
||||||
Concatenate several movex commands and applies a blending radius
|
Concatenate several movex commands and applies a blending radius
|
||||||
pose_list is a list of pose.
|
pose_list is a list of pose.
|
||||||
@ -359,10 +364,36 @@ class URRobot(object):
|
|||||||
header = "def myProg():\n"
|
header = "def myProg():\n"
|
||||||
end = "end\n"
|
end = "end\n"
|
||||||
prog = header
|
prog = header
|
||||||
|
# Check if 'vel' is a single number or a sequence.
|
||||||
|
if isinstance(vel, number.Number):
|
||||||
|
# Make 'vel' a sequence
|
||||||
|
vel = len(pose_list) * [vel]
|
||||||
|
elif not isinstance(vel, collections.Sequence):
|
||||||
|
raise RobotException(
|
||||||
|
'movexs: "vel" must be a single number or a sequence!')
|
||||||
|
# Check for adequate number of speeds
|
||||||
|
if len(vel) != len(pose_list):
|
||||||
|
raise RobotException(
|
||||||
|
'movexs: "vel" must be a number or a list '
|
||||||
|
+ 'of numbers the same length as "pose_list"!')
|
||||||
|
# Check if 'radius' is a single number.
|
||||||
|
if isinstance(radius, number.Number):
|
||||||
|
# Make 'radius' a sequence
|
||||||
|
radius = len(pose_list) * [radius]
|
||||||
|
elif not isinstance(radius, collections.Sequence):
|
||||||
|
raise RobotException(
|
||||||
|
'movexs: "radius" must be a single number or a sequence!')
|
||||||
|
# Require adequate number of radii.
|
||||||
|
if len(radius) != len(pose_list):
|
||||||
|
raise RobotException(
|
||||||
|
'movexs: "radius" must be a number or a list '
|
||||||
|
+ 'of numbers the same length as "pose_list"!')
|
||||||
for idx, pose in enumerate(pose_list):
|
for idx, pose in enumerate(pose_list):
|
||||||
if idx == (len(pose_list) - 1):
|
if idx == (len(pose_list) - 1):
|
||||||
radius = 0
|
radius = 0
|
||||||
prog += self._format_move(command, pose, acc, vel, radius, prefix="p") + "\n"
|
prog += self._format_move(command, pose, acc,
|
||||||
|
vel[idx], radius[idx],
|
||||||
|
prefix="p") + "\n"
|
||||||
prog += end
|
prog += end
|
||||||
self.send_program(prog)
|
self.send_program(prog)
|
||||||
if wait:
|
if wait:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user