Ask Your Question

Read a position in a tf message

asked 2014-08-06 11:27:57 -0600

arennuit gravatar image

Hi all,

  1. I am using the universal_robot package and I would like to visualize the end-effector's position error in rqt_plot. I guess I need to compute it in a node of my own and publish it so I can have access to the topic in rqt_plot. Is that correct?

  2. Now in order to start with I thought I would visualize component X of the effector in rqt_plot. So I had a look at the topics published and I could find topic /tf of type tf2_msgs/TFMessagewhich contains an array of transforms of type geometry_msgs/TransformStamped[] (itself containing the translation info a few levels below). This boils down to me trying to plot topic /tf/transforms[whatToPutHere?]/transform/translation/x. But I never can get my curve correctly displayed:

    • If whatToPutHere = blank (nothing, empty): ros_plot lets me add the topic to plot, but the curve value is 0
    • If whatToPutHere = 0, 1, 2... : ros_plot lets me add the topic to plot, but the curve value is 0
    • If whatToPutHere = ee_link (name of the effector's link): ros_plot does not let me add the topic to plot

Any idea of what goes wrong here?

image description



edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-08-20 11:27:41 -0600

ahendrix gravatar image

tf is published in a distributed fashion, with multiple nodes publishing different parts of the tree to the /tf topic.

Practically, what this means is that each transform array that is published may or may not contain the transform information that you're looking for, and may or may not be in the same order each time. (it's also very difficult to plot the components of a quaternion and understand what is going on).

The transforms in the /tf topic only span a single link in the tree, so it isn't possible to directly extract a transform that spans multiple links. This is why the tf library exists.

I think the better approach here is your first suggestion; to write a node which subscribes to tf, looks up the transform that you're interested in, and republishes that for plotting.

edit flag offensive delete link more


@ahendrix: I got it, thanks for your help!

arennuit gravatar image arennuit  ( 2014-08-25 00:34:13 -0600 )edit

i have same problem . can you help me ?

zakizadeh gravatar image zakizadeh  ( 2017-02-12 11:22:39 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-08-06 11:27:57 -0600

Seen: 1,194 times

Last updated: Aug 20 '14