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
  • Rotate only one axis relative to current position

Rotate only one axis relative to current position

Sample of how to rotate only one axis relative to current position

Last modified on Jan 29, 2025

Examples are valid for:
CB2 Software version: 1.8.16941
CB3 Software version: 3.1.17779
e-Series Software version: All versions

Note that older or newer software versions may behave differently.

These examples can be used for both CB2, CB3 and e-Series.

 

One example of rotate only one axis to a special angle with UR script function and variables

 

This example moves the robot 3 times in the Robot Program.
First move Wrist 3 10 degree then wait 2 seconds then move 10 degree more in same direction and wait 2 seconds ; then robot wrist 3 rotate 20 degree reverse and wait 2 seconds.

Script code get_joint_positions is used to return the actual angular positions of all joints. The current actual angular positions vector in radians is selected by using square brackets [] : Base[0], Shoulder[1], Elbow[2], Wrist1[3], Wrist2[4], Wrist3[5].

Script code d2r is used to convert from degrees to radians. This code is not available in all software version and the calculation: (degree/180)*3.14149262 need to be used.

Toolanglestep

 

Two programs is attached. One using the script code to convert from degrees to radians(ToolAngleStep_1.urp) and one where the calculation is used(ToolAngleStep_0.urp)

Attached files


ToolAngleStep_0.urp
ToolAngleStep_1.urp
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