tested examples scripts

This commit is contained in:
Olivier R-D 2013-09-18 10:48:58 +02:00
parent c056a6c7a5
commit a566b2ae69
3 changed files with 18 additions and 14 deletions

View File

@ -4,28 +4,32 @@ import urx
import logging
if __name__ == "__main__":
rob = urx.Robot("192.168.128.120", logLevel=logging.INFO)
rob = urx.Robot("192.168.1.6", logLevel=logging.WARNING)
rob.set_tcp((0,0,0,0,0,0))
rob.set_payload(0.5, (0,0,0))
try:
l = 0.05
v = 0.05
a = 0.3
rob.translate((l, 0, 0))
j = rob.getj()
print("Initial joint configuration is ", j)
t = rob.get_transform()
print("Transformation from base to tcp is: ", t)
print("Translating in x")
rob.translate((l, 0, 0), acc=a, vel=v)
pose = rob.getl()
print("robot tcp is at: ", pose)
print("moving in z")
pose[2] += l
rob.movel(pose, acc=a, vel=v)
t = rob.get_transform()
print("Transformation from base to tcp is: ", t)
print("Translate in -x and rotate")
t.orient.rotate_zb(pi/4)
t.pos[0] -= l
rob.apply_transform(t, vel=v, acc=a)
t.pos[2] -= l
new_t = rob.apply_transform(t, vel=v, acc=a)
print("Transformation from base to tcp is: ", new_t)
print("Sending robot back to original position")
rob.movej(j, acc=0.8, vel=0.2)
finally:

View File

@ -1,10 +1,9 @@
from math import pi
import urx
import logging
if __name__ == "__main__":
rob = urx.Robot("192.168.128.120", logLevel=logging.INFO)
rob = urx.Robot("192.168.1.6", logLevel=logging.INFO)
rob.set_tcp((0,0,0,0,0,0))
rob.set_payload(0.5, (0,0,0))
try:
@ -13,13 +12,14 @@ if __name__ == "__main__":
a = 0.3
pose = rob.getl()
print("robot tcp is at: ", pose)
print("absolute move in base coordinate ")
pose[2] += l
rob.movel(pose, acc=a, vel=v)
print("relative move in base coordinate ")
rob.translate((0, 0, -z), acc=a, vel=v)
print("relative move in tool coordinate")
rob.translate_tool((0, 0, -z), acc=a, vel=v)
rob.translate_tool((0, 0, z), acc=a, vel=v)
rob.translate((0, 0, -l), acc=a, vel=v)
print("relative move back and forth in tool coordinate")
rob.translate_tool((0, 0, -l), acc=a, vel=v)
rob.translate_tool((0, 0, l), acc=a, vel=v)
finally:
rob.cleanup()

View File

@ -4,7 +4,7 @@ import logging
if __name__ == "__main__":
rob = urx.Robot("192.168.128.120", logLevel=logging.INFO)
rob = urx.Robot("192.168.1.6", logLevel=logging.INFO)
try:
l = 0.1
v = 0.07