Rotate only one axis relative to current position
Sample of how to rotate only one axis relative to current position
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.
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)