RY tilt using pose_trans in a loop gradually returns to 0

i have a portion of script below where the robot rotates 360degrees only in the RZ direction between lines 9-13.
in the lines following it between 14-18, the robot rotates 360degrees in the RZ direction as well but this time with a tilt of 15degrees in the RY direction.
this tilt is noticeable during the first 3 or so loops but gradually loses it until the final loop where it can be visually confirmed that there is 0 tilt in the RY direction.

can anyone explain the loss in tilt in RY direction?

  $ 8 "original_pose=pose_trans(get_actual_tcp_pose(),p[0,0,distance_to_target,0,0,0])"
  original_pose=pose_trans(get_actual_tcp_pose(),p[0,0,distance_to_target,0,0,0])
  $ 9 "loop_counter:=1"
  global loop_counter=1
  $ 10 "ループ loop_counter≤6"
  while (loop_counter <= 6):
    $ 11 "pose:=pose_trans(original_pose, p[0,0,0,0,0,d2r(60*loop_counter)])"
    global pose= pose_trans (original_pose, p[0,0,0,0,0, d2r (60*loop_counter)])
    $ 12 "movej(pose, a=2, v=2)"
    movej(pose, a=2, v=2)
    $ 13 "loop_counter:=loop_counter+1"
    global loop_counter=loop_counter+1
  end
  $ 14 "loop_counter:=1"
  global loop_counter=1
  $ 15 "ループ loop_counter≤6"
  while (loop_counter <= 6):
    $ 16 "pose:=pose_trans(original_pose, p[0,0,0,0,d2r(15),d2r(-60*loop_counter)])"
    global pose= pose_trans (original_pose, p[0,0,0,0,d2r(15), d2r (-60*loop_counter)])
    $ 17 "movej(pose, a=2, v=2)"
    movej(pose, a=2, v=2)
    $ 18 "loop_counter:=loop_counter+1"
    global loop_counter=loop_counter+1
  end

Hello,

This is likely due to the robot’s use of rotation vector for pose rotation instead of RPY. Our brains are used to thinking about rotation in RPY. The function rpy2rotvec() can be used to convert from RPY to rotation vector.

https://www.universal-robots.com/articles/ur/application-installation/explanation-on-robot-orientation/

If I’m understanding your goal correctly, the code below should achieve what you’re looking for:

2 Likes

hey @miwa,

thanks a lot for the explanation and the codes. it works perfectly and solves my problem.