URScript: Move with respect to a custom feature/frame - 20115


Example is valid for:                                              

CB2 Software version: 1.8.16941                          
CB3 Software version: 3.2.19293                         
Note that older or newer software versions may behave differently.

This example can be used for both CB2 and for CB3.

 


In order to demonstrate how to move with respect to a feature (point, line or plane) we can use the script commands MOVEL and POSE_TRANS:

Move to position (linear in tool-space)

Syntax

movel(pose, a=1.2, v=0.3, t=0, r=0)

Parameters

pose: target pose (pose can also be specified as joint positions, then forward kinematics is used to calculate the corresponding pose)

a: tool acceleration [m/sˆ2]

v: tool speed [m/s]

t: time [S]

r: blend radius [m]

By default the “pose” parameter in the above syntax is always w.r.t to the base-frame.

Logically if we can express the “pose” variable w.r.t to feature-frame as a pose w.r.t to the base-frame then we should be able to pass that pose and have the robot move to the required point. This is where we use the pose_trans function.,

 

Pose Transformation

Syntax

resulting_pose  = pose_trans(p_feature, p_wrt_feature)

Parameters

p_feature: starting pose (spatial vector representing feature frame)

p_wrt_feature : pose relative to feature-frame (spatial vector w.r.t feature frame as new origin)

Return Value

resulting_pose  : pose relative to base-frame

 

The first argument, p_feature, is used to transform the second argument, p_wrt_feature to the base co-ordinate system.

This function can be seen as two steps.

a) The function transforms, i.e translates and rotates, p_wrt_feature by the parameters of p_feature.

b) The function is used to get the resulting pose, when first making a move of p_feature and then from that point in space, a relative move of p_wrt_feature.

If the poses were regarded as transformation matrices, it would look like:

T(waypoint->base) = T(waypoint->feature) * T(feature->base)

 

This idea will be made clearer by considering a few example scenarios:

 

a)      Move with respect to tool. The below code will have the robot move 10cm along the Z-axis of the tool and rotate 90 degrees about the Z-axis.

X,Y and Z values are expressed in metres and Rx,Ry and Rz values are expressed in radians.

Example code:

global pose_wrt_tool = p[0,0,0.1,0,0 , 1.57]

global pose_wrt_base = pose_trans(get_forward_kin(), pose_wrt_tool)

movel( pose_wrt_base , a=1.2, v=0.25)

       get_forward_kin() returns current pose.

 

b)      Move with respect to feature. The below code will have the robot move 10cm along the X, Y and Z axes of the feature and rotate 90 degrees about the Z-axis.

Example code:

global pose_wrt_feature = p[0.1,0.1,0.1,0,0 , 1.57]

global feature_wrt_base = p[0.03,0.03,0.03,0,0,0]

global pose_wrt_base = pose_trans(feature_wrt_base, pose_wrt_feature)

movel( pose_wrt_base , a=1.2, v=0.25)

 

c)      Express a point w.r.t a feature. If you need to express a pose (or a point) in base-frame, as a point w.r.t feature frame:

This is how you would proceed:

Point x w.r.t base-frame has pose      : P_x_b 
Feature f w.r.t base-frame has pose   : P_f_b 
Point x as a pose w.r.t f-frame           : P_x_f 
Mathematically;        

P_x_f = (P_f_b)^(-1) * P_x_b 

P_b_f = (P_f_b)^(-1)

As script-code: 
       global P_b_f = pose_inv(P_f_b) 

       global P_x_f = pose_trans(P_b_f, P_x_b) , This is a good way to calculate the normal distance of a point from a any given plane(The z-index of the resulting pose will always be the normal distance in metres)

Want to get notified about updates?

You are welcome to sign up for notifications about new relevant information and articles that could be interesting for you.

Universal Robots A/S needs the contact information you provide to us to contact you about our products and services. You may unsubscribe from these communications at anytime. For information on how to unsubscribe, as well as our privacy practices and commitment to protecting your privacy, check out our Privacy Policy.

Need help?

Did you find what you needed on this site? For additional information please contact one of our distributors.