diff --git a/examples/matrices.py b/examples/matrices.py index c47d5e9..d162a9d 100644 --- a/examples/matrices.py +++ b/examples/matrices.py @@ -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: diff --git a/examples/simple.py b/examples/simple.py index 8776e57..94129bc 100644 --- a/examples/simple.py +++ b/examples/simple.py @@ -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() diff --git a/examples/test_movep.py b/examples/test_movep.py index 1f88937..d0aee51 100644 --- a/examples/test_movep.py +++ b/examples/test_movep.py @@ -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