Universal Robots Forum

How to get tcp pose in feature coordinates?

The script command get_actual_tcp_pose() defaults to base feature coordinates. I want to get TCP coordinates inside a plane feature that I have defined (I need the x and y coordinates as offsets for a variable waypoint calculation for movement inside that feature plane). How can I do this using script commands?

Edit: I’d like to provide a bit more detail…I’ve read a few posts and attempted to use pose_trans() but it’s not giving me the results I expect. This is probably basic, but I’m relatively new to this and I can’t figure out what I’m doing wrong.

The description I’ve read of pose_trans() shows me this:

What I want to do is this:

So far I can’t get this to work…any ideas would be greatly appreciated!

1 Like

I’ve answered my own question. So for anyone else who runs into this,

result=pose_trans(pose_inv(pose2),pose1)
x offset = result[0]
y offset = result[1]

Assuming, of course, that your x and y axes of the feature plane and your tool are pointing the same direction. If not, it should be a simple 2D coordinate transformation if you know the angle of rotation.

1 Like

@anna

get_actual_tcp_pose() will give you “Base to TCP”
pose_inv( get_actual_tcp_pose() ) will give you “TCP to Base”.
The “pose1” is the vector “Base to Feature”.

pose_trans( "TCP to Base", "Base to Feature" ) will give you “TCP to Feature”.
Hence you might want to call the pose_inv() to get “Feature to TCP”

2 Likes

Just so I understand…

If I want to get position of TCP with respect to a feature, will this work?

I have four variables defined as poses - location_one, location_one_inv, feature_loc, current_to_feature.

I move the arm to set my feature “zero” point. I define the feature and then run a script to get the pose and assign it to the variable feature_loc.

Then to calculate the current position of the arm with respect to my feature:

location_one = get_actual_tcp_pose ( )
location_one_inv = pose_inv (location_one)

current_to_feature = pose_trans (location_one_inv, feature_loc)

Will this give me the current position with respect to the feature ?

Sorry if this is basic, I’m just getting started.

Thanks for any help you can provide.

Mark

From your description, it sounds like you are on track, but you can check by going to the move tab, then under “feature” in the upper right-hand corner, choose the feature you want in the drop-down menu. Just below that, it shows the x,y,z and Rx, Ry, Rz of your tool center point. The x and y values displayed there should match the x and y value of your current_to_feature (make sure the tool center point shown is the one you are using).

Are the axes of your feature pointing the same direction as the axes of the base feature? If not, you will also have to perform a coordinate rotation to get the correct values, since get_actual_tcp_pose() returns only base coordinates. We worked out coordinate rotation here:

http://forum.universal-robots.com/t/ur5-vision-coordinate-system-difficulties/499

Good luck!

1 Like