Universal Robots+

Calculate relative position between two points

I’m trying to calculate the relative position between two points.

gauge (feature waypoint) = p[0.42155,0.06483,0.30493,-0.00004,0.00003,1.73676]

actual_tcp_pose = get_actual_tcp_pose() or get_actual_tool_flange_pose()

(in this case, p[0.23634,0.16249,0.26557,2.00009,-0.74194,2.05458])

Either way the result needs to be offset depending on one of the several TCP’s stored.

actual_tcp_pose —> gauge

p[0,0,0,0,0,0] —> p[?,?,?,?,?,?]

The gripper in use is holding a cylinder where the gauge point is on the surface of, where the diameter is 90mm, and I’ve measured the offset to approx 215mm (give or take), which the result should be close to p[?,?,~0.215,?,?,?]

The x and y would theoretically be -45 to 45 with the 90mm diameter.

I’ve tried using pose_sub, pose_trans, pose_dist (need more then just distance). There doesn’t appear to be a command/function available for this, unless I’m missing something. Has someone come across this and found a solution to calculate this?

The idea is to use 1 or 2 TCP’s, change it to be the same position of the gauge, but in relation to the flange, and store/manipulate as needed.

Hi @brock, not sure I really understand the use case here, but perhaps following the instructions using pose trans and pose inv in the section

Express a point w.r.t a feature

at the bottom of this article will help to give you the tcp pose in the gauge feature frame and point you in the right direction?

https://www.universal-robots.com/articles/ur/urscript-move-with-respect-to-a-custom-featureframe/

Hi @ajp, the answer was provided a few days ago here:

Thanks for responding though.