Articles Download Safety & Security Forum myUR Go to Main Site

Universal Robots A/S
Energivej 51
DK-5260 Odense S

T: +45 8993 8989
sales@universal-robots.com

 
  • Articles
  • Download
  • Safety & Security
  • Forum
  • myUR
  • Go to Main Site
  • Support
  • Articles
  • URScript: Move with respect to a custom feature/frame

URScript: Move with respect to a custom feature/frame

Demonstrates how to Move with respect to a custom feature/frame using URScript language

Last modified on Jan 29, 2025

Example is valid for:                                              

CB2 Software version: 1.8.16941                          
CB3 Software version: 3.2.19293
e-Series Software version: All versions                       

Note that older or newer software versions may behave differently.

This example can be used for both CB2,CB3 and e-Series.

 

 

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)

logo

Product

  • UR3e Robot
  • UR5e Robot
  • UR10e Robot
  • UR16e Robot
  • UR20 Robot
  • UR+ Products

Company

  • About us
  • Contact us
  • Careers We're hiring
  • UR merchandise

Training / Resources

  • Academy
  • Technical Resources
  • Articles
  • FAQ

Insights

  • Blog
  • Case stories
  • Content library
  • News centre
  • Podcast
  • Webinars & Events

Get in touch

  • Ask an Expert
  • Schedule a no-cost assessment
  • Find a distributor
  • Customer support

Connect with us

  • LinkedIn
  • Facebook
  • Twitter
  • YouTube
  • Instagram
  • Universal Robots A/S
  • Energivej 51
  • DK-5260 Odense S
  • T: +45 89 93 89 89
  • sales@universal-robots.com
  • US Corporate Office
  • 27-43 Wormwood St.
  • 02210 Boston, MA.
  • +1-844-GO-COBOT
  • ur.na@universal-robots.com
  • Copyright @ Universal Robots 2025
  • Cookie policy
  • Privacy policy
  • Universal Robots A/S
  • Energivej 51
  • DK-5260 Odense S
  • T: +45 89 93 89 89
  • sales@universal-robots.com
  • US Corporate Office
  • 27-43 Wormwood St.
  • 02210 Boston, MA.
  • +1-844-GO-COBOT
  • ur.na@universal-robots.com

Copyright © Universal Robots 2025

Cookie policy
Privacy policy