It has been many years since I was deep into V+ language, but something doesn't seem correct with your code. Perhaps. Maybe. Possibly.
Your method of calculating and using the INVERSE transform dif bothers me for some reason, and I cannot discern why (too many years ago).
Establish a frame (user coord sys) in space with
SET pallet = FRAME(loc.origin, loc.x.axis, loc.y.axis, loc.origin)
This assumes that you taught the three frame locations properly (and taught with an accurate tool):
- loc.origin is at the ORIGIN of the new frame
- loc.x.axis is ON the X-AXIS of the new frame
- loc.y.axis is somewhere in the positive X-Y plane of the new frame (not required to be ON the Y-AXIS of the frame, but is nice if it is)
- fourth argument defines the location of the new frame origin
- orientation of the three frame location points is irrelevant, only X, Y, Z are used to calculate the frame
Do all of that, then your command to calculate a point relative to the new frame pallet is:
SET pick = pallet:TRANS(x_offset, y_offset, z_offset)
BUT it is critical to recognize that the new point pick has the orientation of the new frame pallet. That is, if your frame pallet Z-AXIS is pointing UP (e.g., towards the ceiling) and you desire to have your gripper Tool Coord Sys Z-AXIS pointing DOWN to the workpiece (e.g, towards the floor), then you must reverse the orientation.
SET pick = pallet:TRANS(x_offset, y_offset, z_offset):TRANS( <either RX = 180, or RY = 180> )
If frame pallet is taught with foresight, then the pallet Z-AXIS is pointed the direction you need for the tool Z-AXIS, you just have to adapt the X, Y, Z offsets to match your physical position.