bump version
This commit is contained in:
parent
ae0b56c644
commit
4a8559a111
@ -1,9 +1,9 @@
|
|||||||
"""
|
"""
|
||||||
Python library to control an UR robot through its TCP/IP interface
|
Python library to control an UR robot through its TCP/IP interface
|
||||||
"""
|
"""
|
||||||
__version__ = "0.8.2"
|
__version__ = "0.9.0"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
from .robot import Robot, RobotException, URRobot
|
from urx.robot import Robot, RobotException, URRobot
|
||||||
|
|
||||||
|
35
urx/robot.py
35
urx/robot.py
@ -3,7 +3,6 @@ Python library to control an UR robot through its TCP/IP interface
|
|||||||
DOC LINK
|
DOC LINK
|
||||||
http://support.universal-robots.com/URRobot/RemoteAccess
|
http://support.universal-robots.com/URRobot/RemoteAccess
|
||||||
"""
|
"""
|
||||||
from __future__ import absolute_import # necessary for import tricks to work with python2
|
|
||||||
|
|
||||||
__author__ = "Olivier Roulet-Dubonnet"
|
__author__ = "Olivier Roulet-Dubonnet"
|
||||||
__copyright__ = "Copyright 2011-2015, Sintef Raufoss Manufacturing"
|
__copyright__ = "Copyright 2011-2015, Sintef Raufoss Manufacturing"
|
||||||
@ -62,13 +61,23 @@ class URRobot(object):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.__repr__()
|
return self.__repr__()
|
||||||
|
|
||||||
def is_running(self): # legacy
|
def is_running(self):
|
||||||
return self.secmon.running
|
return self.secmon.running
|
||||||
|
|
||||||
def is_program_running(self):
|
def is_program_running(self):
|
||||||
|
"""
|
||||||
|
check if program is running.
|
||||||
|
After sending a program it might take several 10th of
|
||||||
|
a second before the robot enters the running state
|
||||||
|
"""
|
||||||
return self.secmon.is_program_running()
|
return self.secmon.is_program_running()
|
||||||
|
|
||||||
def send_program(self, prog):
|
def send_program(self, prog):
|
||||||
|
"""
|
||||||
|
send a complete program using urscript to the robot
|
||||||
|
the program is executed immediatly and any runnning
|
||||||
|
program is interrupted
|
||||||
|
"""
|
||||||
self.logger.info("Sending program: " + prog)
|
self.logger.info("Sending program: " + prog)
|
||||||
self.secmon.send_program(prog)
|
self.secmon.send_program(prog)
|
||||||
|
|
||||||
@ -179,7 +188,7 @@ class URRobot(object):
|
|||||||
prog = "set_tool_voltage(%s)" % (val)
|
prog = "set_tool_voltage(%s)" % (val)
|
||||||
self.send_program(prog)
|
self.send_program(prog)
|
||||||
|
|
||||||
def wait_for_move(self, radius=0, Target=None):
|
def wait_for_move(self, radius=0, target=None):
|
||||||
"""
|
"""
|
||||||
wait until a move is completed
|
wait until a move is completed
|
||||||
radius and target args are ignored
|
radius and target args are ignored
|
||||||
@ -351,6 +360,9 @@ class URRobot(object):
|
|||||||
self.stopj()
|
self.stopj()
|
||||||
|
|
||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
|
"""
|
||||||
|
close connection to robot and stop internal thread
|
||||||
|
"""
|
||||||
self.logger.info("Closing sockets to robot")
|
self.logger.info("Closing sockets to robot")
|
||||||
self.secmon.cleanup()
|
self.secmon.cleanup()
|
||||||
if self.rtmon:
|
if self.rtmon:
|
||||||
@ -358,6 +370,10 @@ class URRobot(object):
|
|||||||
shutdown = cleanup #this might be wrong since we could also shutdown the robot hardware from this script
|
shutdown = cleanup #this might be wrong since we could also shutdown the robot hardware from this script
|
||||||
|
|
||||||
def set_freedrive(self, val):
|
def set_freedrive(self, val):
|
||||||
|
"""
|
||||||
|
set robot in freedrive/brackdrive mode where an operator can jogg
|
||||||
|
the robot to wished pose
|
||||||
|
"""
|
||||||
if val:
|
if val:
|
||||||
self.send_program("set robotmode freedrive")
|
self.send_program("set robotmode freedrive")
|
||||||
else:
|
else:
|
||||||
@ -399,6 +415,9 @@ class Robot(URRobot):
|
|||||||
self.set_csys("Robot", m3d.Transform()) #identity
|
self.set_csys("Robot", m3d.Transform()) #identity
|
||||||
|
|
||||||
def set_tcp(self, tcp):
|
def set_tcp(self, tcp):
|
||||||
|
"""
|
||||||
|
set robot flange to tool tip transformation
|
||||||
|
"""
|
||||||
if type(tcp) == m3d.Transform:
|
if type(tcp) == m3d.Transform:
|
||||||
tcp = tcp.pose_vector
|
tcp = tcp.pose_vector
|
||||||
URRobot.set_tcp(self, tcp)
|
URRobot.set_tcp(self, tcp)
|
||||||
@ -419,6 +438,10 @@ class Robot(URRobot):
|
|||||||
self.csys = self.csys_dict[name]
|
self.csys = self.csys_dict[name]
|
||||||
|
|
||||||
def set_orientation(self, orient, acc=None, vel=None, radius=0, wait=True):
|
def set_orientation(self, orient, acc=None, vel=None, radius=0, wait=True):
|
||||||
|
"""
|
||||||
|
set tool orientation using a orientation matric from math3d
|
||||||
|
or a orientation vector
|
||||||
|
"""
|
||||||
if type(orient) is not m3d.Orientation:
|
if type(orient) is not m3d.Orientation:
|
||||||
orient = m3d.Orientation(orient)
|
orient = m3d.Orientation(orient)
|
||||||
trans = self.get_pose()
|
trans = self.get_pose()
|
||||||
@ -498,10 +521,16 @@ class Robot(URRobot):
|
|||||||
return trans
|
return trans
|
||||||
|
|
||||||
def get_orientation(self, wait=False):
|
def get_orientation(self, wait=False):
|
||||||
|
"""
|
||||||
|
get tool orientation in base coordinate system
|
||||||
|
"""
|
||||||
trans = self.get_pose(wait)
|
trans = self.get_pose(wait)
|
||||||
return trans.orient
|
return trans.orient
|
||||||
|
|
||||||
def get_pos(self, wait=False):
|
def get_pos(self, wait=False):
|
||||||
|
"""
|
||||||
|
get tool tip pos(x, y, z) in base coordinate system
|
||||||
|
"""
|
||||||
trans = self.get_pose(wait)
|
trans = self.get_pose(wait)
|
||||||
return trans.pos
|
return trans.pos
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user