# xyz position tracking of UR10

Hi all, I am currently working on a UR10 robot that has to do a certain contact operation on parts. i have the trajectory execution working and it executes the operation almost flawlessly aside from the start and stop of the operation. Therefore i need to be able to get the realtime position of the TCP link of the robot. I have been looking at TF2 but i am not sure if i can use it this purpose as it seems it only publishes the transform matrix. I have also been looking at the ROS navigation stack but it says it is only in 2d and it looks like it is for robots that actually move their entire base in space. I probably need something that does use TF2 but then calculates the position. Thanks in advance

edit retag close merge delete

Can you please clarify: Do you want to control the robot or just observer its tcp position?

( 2019-08-20 05:35:21 -0500 )edit

i do not want to change the trajectory when it is running, I indeed just want to observe the robot when it is running said trajectory.

( 2019-08-20 05:45:40 -0500 )edit

Sort by » oldest newest most voted

Therefore i need to be able to get the realtime position of the TCP link of the robot. I have been looking at TF2, [..]

this would indeed seem like a task you could use TF for.

i am not sure if i can use it this purpose as it seems it only publishes the transform matrix.

I'm not sure what you mean by this, as "the transform matrix" would seem to be exactly what you'd need (unless you are wondering where the rotation part has gone, but that is included as well).

TF will give you the transform between any two frames in your TF tree. For your case, that would probably be some base frame (perhaps even the base frame in the UR10's urdf) and some tool frame (or the default tool0 frame).

Asking TF for that transform will immediately tell you where the tool frame is wrt the base frame.

That transform is the pose of the TCP (relative to the base you've chosen of course).

If you'd like to track this over time, then perform periodic lookups of that same transform.

A rather arbitrary -- but illustrative -- example of this may be found here: floweisshardt/atf/atf_metrics/src/atf_metrics/calculate_path_length.py.

more

i might have been confused by looking at the TF topic that the UR already publishes, I will get back to you when i have implemented the suggestions.

( 2019-08-20 08:10:34 -0500 )edit

If you're using ur_modern_driver then you could use tool0_controller instead of the regular tool0. It would be the same transform though.

( 2019-08-20 08:38:07 -0500 )edit

You need a tf listener. Depending on your frame names, you need something like this:

transformStamped = tfBuffer.lookupTransform("base", "tool0", ros::Time(0));


You xyz are in transformStamped.transform.x and y, z respectively.

more