Linear move while rotating?

Hi, I am trying to do a linear move while also rotating the wrist of my UR3.
I know you can’t use joint rotations on a MoveL so I was thinking that right before the MoveL I could have it set a variable to true so that a thread can detect the variable is true and then start spinning until the MoveL finishes and sets the variable back to false.

Problem is I cannot find a function to make the wrist rotate. Is there a better way to move linearly (for precision) and spin?
I need to insert a piece into a hole while spinning it and apply force and being pretty precise on movement.
I appreciate any help.

1 Like

Does anyone have any idea? I hope I provided enough information.

Hi @jimmy2,

Welcome to the UR community. I am assuming that you would like to spin the wrist more than a full rotation during your movement?

In that case you can take a look at the speedl() script function or alternatively the path_offset if you would like to seperate the linear movement and the rotation.

I hope that assist you your way to what you would like to achieve!

Best regards
Ebbe

Hello @Ebbe,

My coworker and I have been attempting to use Offset() and SpeedL() but they seems to be oriented around the base when we need it to be oriented around the TCP so that it will rotate.

We are looking to have wrist 3 rotate counter clockwise while having the TCP move on the Z axis. We were hoping to use the MoveL so that it would stick to the specified line.

Thanks
-Jimmy

Hi @jimmy2,

For the path_offset you can actually specify the type and thereby let it act in the tool frame.
In the speedl case you need to apply the math your self. Hopefully you can use this snippet as inspiration:

def rotate_speed_in_frame(frame, speed):
  local p_tcp = p[0,0,0, frame[3], frame[4], frame[5]]

  local speed_pos_p = p[speed[0], speed[1], speed[2], 0, 0, 0]
  local speed_rot_p = p[speed[3], speed[4], speed[5], 0, 0, 0]

  local trans = pose_trans(p_tcp, speed_pos_p)
  local rot = pose_trans(p_tcp, speed_rot_p)

  return [trans[0], trans[1], trans[2], rot[0], rot[1], rot[2]]
end

tool_speed = [0,0,0.1, 0,0,-6]
acceleration = 10
t = 2
base_speed = rotate_speed_in_frame(pose_inv(get_target_tcp_pose()), tool_speed )
speedl(base_speed,  acceleration, t) 

Then you need to adjust tool_speed, acceleration and t to your needs.

Feel free to ask if that did not answer your question.

Ebbe