Test Z Position Against A Stored Z Position

I’m machine tending with a UR10 and use a pin bolted to the side of one of my Hand-E Grippers to position the part through a hole before closing the vise on it.

I load the part with the Gripper finger, then rotate around so the pin goes through the part and into a slot in the jaws to align the part with the jaws. There is a shoulder on the pin that contacts the part when the Z is all the way down and that shoulder pushes the part flat in the jaws (The Z value here should be the same for all parts). Then the jaws close and pull the pin out. Then I test to make sure the part was loaded successfully by running the pin through the hole again.

Putting the pin back in the hole sometimes gives false contact readings so it’s not reliable.

A better way is to test if the Z value while positioning the part is the same every time.

What I’d like to do is load a part and manually verify it’s loaded correctly with the pin all the way down so the shoulder touches the part as it sits flat. I want to store that Z value in a constant and test this value in production on every part.

So when the pin goes all the way and stops while loading production I want to compare that Z value to the Constant and if it’s not as deep as it should be, I want to throw up a Popup to stop movement and notify the Operator to re-align the part.

I don’t do much scripting but know there are a few functions for getting and setting TCP poses/positions so I’m positive it can be done, just not sure how to go about it and if I can ONLY store just Z values or if I need all 6 positions.

Here’s the current program and where I want to store Z and where I want to test it against the Constant:

This is the jaw and slot the pin aligns with:

image

Here’s the pin just starting into the part:

image

And the pin all the way against the shoulder holding the part flat, this is the Z value that I want to test against the constant.

image

Thanks in advance.

# in (mm)
tolerance := 0.001

#wrt to base
Z_value := get_actual_tcp_pose()
# returns current p[x,y,z,rx,ry,rz]

# use index value [2] for Z-value in pose, norm() is absolute value function in URscript
if( ( norm( Z_value[2] - PushdownPoint[2] ) ) > tolerance ):
   popup("Error - Check pin is seated properly.", True, True)

‘tolerance’ would need to be tweaked to right threshold value (currently i have it set to 0.001m or 1mm). This can all be done using polyscope nodes (I call them ‘nodes’ or ‘functions’ whatever you want to call them as shown in your program picture - basically two assignments, if-statement, and using expressions with functions) I wrote it in URscript code (shown above). If you plan to check continuously while in forcemode() you need to have a count or something to trigger after a set amount of try’s or time.

There may be other ways to achieve what you are after and someone else may have a better solution for you, anyways hope this is somewhat helpful, and best of luck!

3 Likes

As Michael writes, you can extract 1 value from a list, like Z, by putting the index number of you desired variable inside squre brackets. We are using zero based numbering, so the first position in a list is 0.

Eg.

CurrentPos = get_actual_tcp_pose()
X = CurrentPos[0]
Y = CurrentPos[1]
Z = CurrentPos[2]

We are using the same principle here when comparing the force in Z: Measure object dimensions using only a gripper - YouTube

1 Like

I’m able to get everything to work but the numbers are off. What units does UR’s get_actual_tcp_pose use?

I’m working in Inches with everything relative to Base.

I brought the TCP down to the table then moved up exactly 1 inch to set my Start waypoint.

The program moves to the Start point and stores the value at .06079. Then I use Force to move Z down to touch the table (which is now exactly 1 inch down in Z) and store that value at .03534. Then I move back to start and do the maths to subtract the 2nd point from the first and get .02534. Then I multiply that value by 25.4 to convert to INCHES and get .64642.

Shouldn’t that last value be 1.0000-ish? Or is the robot using something besides metric?

You would divide by 25.4 not multiply to go from mm to inches. Pose data is kept in meters and radians so 0.06079 m = 60.79mm - 35.34mm = 25.34mm → /25.4mm (or 1 inch) = 1 (well 0.99764 technically).

From meters to INCHES you would need to take your value and multiply to (1000/25.4) ~39.37

1 Like