update README
This commit is contained in:
parent
2a6a103803
commit
a283eef172
53
README.md
53
README.md
@ -1,9 +1,10 @@
|
|||||||
|
|
||||||
urx is a python library to control a robot from 'Universal robot'. It is published under the GPL license and comes with absolutely no guarantee, although it has been used in many application with several version of UR5 and UR10 robots.
|
urx is a python library to control the robots from 'Universal robot'. It is published under the GPL license and comes with absolutely no guarantee.
|
||||||
|
|
||||||
It is meant as an easy to use module for pick and place operations, although it has been used for welding and other sensor based applications that do not require high update rate.
|
It is meant as an easy to use module for pick and place operations, although it has been used for welding and other sensor based applications that do not require high control frequency.
|
||||||
|
|
||||||
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 is known to work with all release robots from Universal Robot.
|
|
||||||
|
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 is known to work with all release robots from Universal Robot. Python-math3d is a very good library and is advised to anybody programming robots using python!
|
||||||
|
|
||||||
urx was primarily developed by [Olivier Roulet-Dubonnet](https://github.com/oroulet) for [Sintef Raufoss Manufacturing](http://www.sintef.no/manufacturing/).
|
urx was primarily developed by [Olivier Roulet-Dubonnet](https://github.com/oroulet) for [Sintef Raufoss Manufacturing](http://www.sintef.no/manufacturing/).
|
||||||
|
|
||||||
@ -15,16 +16,17 @@ import urx
|
|||||||
rob = urx.Robot("192.168.0.100")
|
rob = urx.Robot("192.168.0.100")
|
||||||
rob.set_tcp((0, 0, 0.1, 0, 0, 0))
|
rob.set_tcp((0, 0, 0.1, 0, 0, 0))
|
||||||
rob.set_payload(2, (0, 0, 0.1))
|
rob.set_payload(2, (0, 0, 0.1))
|
||||||
|
sleep(0.2) #leave some time to robot to process the setup commands
|
||||||
rob.movej((1, 2, 3, 4, 5, 6), a, v)
|
rob.movej((1, 2, 3, 4, 5, 6), a, v)
|
||||||
rob.movel((x, y, z, rx, ry, rz), a, v)
|
rob.movel((x, y, z, rx, ry, rz), a, v)
|
||||||
print "Current tool pose is: ", rob.getl()
|
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.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.translate((0.1, 0, 0), a, v) #move tool and keep orientation
|
||||||
rob.stopj(a)
|
rob.stopj(a)
|
||||||
|
|
||||||
robot.movel(x, y, z, rx, ry, rz), wait=False)
|
robot.movel(x, y, z, rx, ry, rz), wait=False)
|
||||||
while True :
|
while True :
|
||||||
sleep(0.1) #sleep first since the robot may not have processed the command yet
|
sleep(0.1) #sleep first since the robot may not have processed the command yet
|
||||||
if robot.is_program_running():
|
if robot.is_program_running():
|
||||||
break
|
break
|
||||||
|
|
||||||
@ -38,20 +40,27 @@ robot.stopl()
|
|||||||
try:
|
try:
|
||||||
robot.movel((0,0,0.1,0,0,0), relative=True)
|
robot.movel((0,0,0.1,0,0,0), relative=True)
|
||||||
except RobotError, ex:
|
except RobotError, ex:
|
||||||
print "Robot could not execute move (emergency stop for example), do something", ex
|
print("Robot could not execute move (emergency stop for example), do something", ex)
|
||||||
```
|
```
|
||||||
|
|
||||||
#Development using Transform objects from math3d library:
|
#Development using Transform objects from math3d library:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
|
from urx import Robot
|
||||||
|
import math3d as m3d
|
||||||
|
|
||||||
robot = Robot("192.168.1.1")
|
robot = Robot("192.168.1.1")
|
||||||
robot.set_tcp((0,0,0.23,0,0,0)
|
mytcp = m3d.Transform() # create a matrix for our tool tcp
|
||||||
robot.csys.orient.rotate_zb(pi/4) #just an example
|
mytcp.pos.z = 0.18
|
||||||
trans = robot.get_pose() # get current transformation matrix (tool to base)
|
mytcp.orient.rotate_zb(pi/3)
|
||||||
trans.orient.rotate_yt(pi/2)
|
robot.set_tcp(mytcp)
|
||||||
robot.set_pose(trans)
|
time.sleep(0.2)
|
||||||
trans.pos += math3d.Vector(0,0,0.3)
|
|
||||||
robot.set_pose(trans)
|
# get current pose, transform it and move robot to new pose
|
||||||
|
trans = robot.get_pose() # get current transformation matrix (tool to base)
|
||||||
|
trans.pos.z += 0.3
|
||||||
|
trans.orient.rotate_yb(pi/2)
|
||||||
|
robot.set_pose(trans, acc=0.5, vel=0.2) # apply the new pose
|
||||||
|
|
||||||
|
|
||||||
#or only work with orientation part
|
#or only work with orientation part
|
||||||
@ -60,6 +69,22 @@ o.rotate_yb(pi)
|
|||||||
robot.set_orientation(o)
|
robot.set_orientation(o)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#Other interactive methods/properties
|
||||||
|
|
||||||
|
```python
|
||||||
|
|
||||||
|
from urx import Robot
|
||||||
|
rob = Robot("192.168.1.1")
|
||||||
|
rob.x # returns current x
|
||||||
|
rob.rx # returns 0 (could return x component of axis vector, but it is not very usefull
|
||||||
|
rob.rx -= 0.1 # rotate tool around X axis
|
||||||
|
rob.z_t += 0.01 # move robot in tool z axis for +1cm
|
||||||
|
|
||||||
|
csys = rob.new_csys_from_xpy() # generate a new csys from 3 points: X, origin, Y
|
||||||
|
rob.set_csys(csys)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
#Robotiq Gripper
|
#Robotiq Gripper
|
||||||
|
|
||||||
urx can also control a Robotiq gripper attached to the UR robot. The robotiq class was primarily developed by [Mark Silliman](https://github.com/markwsilliman).
|
urx can also control a Robotiq gripper attached to the UR robot. The robotiq class was primarily developed by [Mark Silliman](https://github.com/markwsilliman).
|
||||||
|
Loading…
x
Reference in New Issue
Block a user