DoF - a Robotiq Community
Warning sign
The Dof Community was shut down in June 2023. This is a read-only archive.
If you have questions about Robotiq products please reach our support team.
colbyj

Hi all,

First thing, I've scowered these forums the last few weeks in an attempt to learn URScript- you guys are truly amazing!

I've been developing a program that uses relative movements, using pose_trans to "add" shifts of p[dx,0,0,0,0,0] or p[dx,dy,0,0,0,0], for example, on an Initial position (that we intend to teach manually). 

An example:

global p_ileft = get_target_tcp_pose() #def initial pose

global p_via = p[0.5,1,0,0,0,0]
global p_to = p[1,0,0,0,0,0]

global p_iCenter = pose_trans(p_ileft, p_via) #def center pose
global p_iright = pose_trans(p_ileft, p_to) #def end pose
#
movec(p_iCenter, p_iright) #MoveC around semicircle
stopl()
sleep(0.01)
movec(p_iCenter, p_ileft) #MoveC back around semicircle
stopl()
sleep(0.01)

Unfortunately, I have to be somewhat vague about our specific application, but I'll do my best. Imagine a fixture with 3 identical semicircle (cross-section) rods, their bases aligned in a semicircle (bottom left, top of arc, and bottom right), all facing inwards- so there's some rotation between them. We effectively need to perform the same motions several times, from different positions and at different angles (in the x-y plane only: the z axis will always remain vertically straight, upwards). 

We'd like to teach each initial rod's initial position (p_ileft above), and have the UR orient its movements based on the rotation between initial (of that rod) waypoints. For example, if we think of the bottom left rod as the original orientation, then the top center one will be shifted 90 degrees (so our "x" will now be vertical from the viewer's perspective). Unfortunately these shifts aren't exactly 90 deg., and we need to be able to run the relative movement scripts from any x-y orientation.

I made a script that (successfully) takes the difference in angles between waypoints and adds them to the initial TCP- defined in the Installation (and manually created into a variable in BeforeStart):

WP_Old = get_target_tcp_pose()
#move to new waypoint
WP_New = get_target_tcp_pose()
p_TCP = TCP_defined #Defined in BeforeStart (the Installation TCP)- currently using p[x,y,z,0,0,0] 

#Take differences in Waypoints to find orientation difference
p_TCP_difference = pose_sub(WP_New, WP_Old)
p_TCP_shift = p[0, 0, 0, p_TCP_difference[3], p_TCP_difference[4], p_TCP_difference[5]] #Take only the angles from the TCP Difference
global p_newTCP = pose_trans(p_TCP, p_TCP_shift)
sleep(0.01)

Thank you in advance for any help- and like I mentioned before, I'm so grateful for this wealth of knowledge on UR scripting. I'd be a lost cause without y'all!