Skip to main content

Python library to control an UR robot

Project description

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.


urx is a python library to control a robot from 'Universal robot'. It has currently been used with several versions of UR5.
Both the 'secondary port' interface and the real-time/matlab interface of the UR controller are used.
urx can optionally use the python-math3d https://launchpad.net/pymath3d library to receive and send transformation matrices to the robot

urx was primarily developed by Olivier Roulet-Dubonnet for Sintef Raufoss Manufacturing and is published under the GPL license:
http://www.sintef.no/manufacturing/

Example use:

import urx

rob = urx.robot("192.168.0.100")
rob.set_tcp((0, 0, 0.1, 0, 0, 0))
rob.set_payload(2, (0, 0, 0.1))
rob.movej((1, 2, 3, 4, 5, 6), a, v)
rob.movel((x, y, z, rx, ry, rz), a, v)
print "Current tool pose is: ", rob.getl()
rob.movel((0.1, 0, 0, 0, 0, 0), a, v, relative=true)# move relative to current pose
rob.translate((0.1, 0, 0), a, v) #move tool and keep orientation
rob.orient((0.1, 0, 0), a, v) #orient tool and keep tool tip position
rob.stopj(a)

robot.movel(x, y, z, rx, ry, rz), wait=False)
while True :
sleep(0.1) #sleep first since the information may be outdated
if robot.is_program_running():
break

robot.movel(x, y, z, rx, ry, rz), wait=False)
while.robot.getForce() < 50:
sleep(0.01)
if not robot.is_program_running():
break
robot.stopl()

try:
robot.movel((0,0,0.1,0,0,0), relative=True)
except RobotError, ex:
print "Robot could not execute move (emergency stop for example), do something", ex

Using matrices:

robot = Robot("192.168.1.1")
robot.set_tcp((0,0,0.23,0,0,0)
calib = mathd3d.Transform()
calib.orient.rotate_zb(pi/4) #just an example
robot.add_csys("mycsys", calib) #set robot corrdinate system
robot.set_default_csys("mycsys")
trans = robot.get_transform() # get current transformation matrix (tool to base)
trans.orient.rotate_yt(pi/2)
robot.apply_transform(trans)
trans.pos += math3d.Vector(0,0,0.3)
robot.apply_transform(trans)


#or only work with orientation part
o = robot.get_orientation()
o.rotate_yb(pi)
robot.orient(o)


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

urx-0.9.0.tar.gz (13.4 kB view details)

Uploaded Source

File details

Details for the file urx-0.9.0.tar.gz.

File metadata

  • Download URL: urx-0.9.0.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for urx-0.9.0.tar.gz
Algorithm Hash digest
SHA256 e5041e5b2bae8990362dcc4c9eb582143ea0493f4b6af915e4ea4ea943e77036
MD5 d669ba58600d3dbe279aab2ae3c21d63
BLAKE2b-256 e7771ba6aaee448dd22872e8966788673cedd7cc7ec03e41db5c6ee14e12a4dc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page