theroretical implementaion of movec and movels, to be tested

This commit is contained in:
Olivier R-D 2013-04-03 11:37:15 +02:00
parent 0cc7318a8e
commit 8b910a5d42
2 changed files with 44 additions and 5 deletions

View File

@ -214,7 +214,9 @@ class SecondaryMonitor(Thread):
with self._prog_queue_lock: with self._prog_queue_lock:
prog.strip() prog.strip()
self.logger.debug("Sending program: prog") self.logger.debug("Sending program: prog")
self._prog_queue.append(prog.encode() + b"\n") if type(prog) != bytes:
prog = prog.encode()
self._prog_queue.append(prog + b"\n")
def run(self): def run(self):

View File

@ -267,13 +267,50 @@ class URRobot(object):
self.logger.debug("Current pose from robot: " + str(pose)) self.logger.debug("Current pose from robot: " + str(pose))
return pose return pose
def movels(self, joints, acc, vel , radius, wait=True): def movec(self, pose, pose_via, pose_to, acc, vel, wait=True):
""" """
where joints is a list of list. dvs: several movel commands must be send as one program in order for radius blending to work. Move Circular: Move to position (circular in tool-space)
This is could easily be implemented in movel by detecting type of the joint variable see UR documentation
""" """
pose = [round(i, 2) for i in pose]
pose_via = [round(i, 2) for i in pose_via]
pose_to = [round(i, 2) for i in pose_to]
prog = "movec(p%s, p%s, p%s, a=%s, v=%s)" % (pose, pose_via, pose_to, acc, vel)
self.send_program(prog)
if not wait:
return None
else:
self.wait_for_move()
return self.getl()
def movels(self, pose_list, acc, vel , radius, wait=True):
"""
where pose_list is a list of pose.
several movel commands must be send as one program in order for radius blending to work.
"""
#TODO: This is could easily be implemented in movel by detecting type of the joint variable
# can be implemented by sending a complete urscript program calling several movel in a row with a radius # can be implemented by sending a complete urscript program calling several movel in a row with a radius
raise NotImplementedError header = "def myProg():\n"
end = "end\n"
template = "movel(p{}s, a={}, v={}, r={})\n"
prog = header
for pose in pose_list:
pose = [round(i, 2) for i in pose]
prog += template.format(pose, acc, vel, radius)
prog += end
self.send_program(prog)
if not wait:
return None
else:
self.wait_for_move()
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)