Shifting the joint position based on cartesian translation

I am using python to run the ur3. I have a series of poses stored in a database. Each pose contains the output of getj() and getl().

I have a case where I need to get the joint positions of a pose translated 10mm in the z-axis.

Is there a way that I can use the IK solver to provide the new joint data for use in the python script?

yes

the cartesian coordinate of a joint pose is calculated with forward kinematics. Make sure you use the right TCP.

cartesian = get_forward_kin(jointpose)

offsetting the pose in z could be done with pose_add if its in base coordinates.
c_offset = pose_add(cartesian, p[0, 0, 0.01, 0, 0, 0])

you can get the joint pose again by doing inverse kinematics.
Use the original jointpose as “q_near”

offset_joints = get_inverse_kin(c_offset, jointpose)

you can then move to the new jointpose.

moveJ(offset_joints)

So the full URScript would be:

cartesian = get_forward_kin(jointpose) 
c_offset = pose_add(cartesian, p[0, 0, 0.01, 0, 0, 0])
offset_joints = get_inverse_kin(c_offset, jointpose) 
movej(offset_joints) 

Thanks!

I will give this a try, but what I have working, I think, for now is simply adding 10mm to the z coord from getl() and passing these coords to movej().

It seems to be working, but I have yet to test it’s accuracy.


pose = getl()
pose[2] += 0.001 * zo
bot.send_program(f"movej(p({pose[0]},{pose[1]},{pose[2]}, a=.5, v=.5, r=0)")