ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

How check if TF's data are being used?

asked 2020-10-20 18:29:04 -0500

I would like to know if there is some way to check if a TF's data are being used by some other process/node.

I have a tf2::broadcaster sending the transforms to ROS, however, I would like to do the entire process that generates the poses only if something is using it.

If I was just publishing into a topic I could use the method getNumSubscribers(). But with a tf2::broadcaster how can I do this?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-10-21 00:42:40 -0500

gvdhoorn gravatar image

updated 2020-10-21 00:45:47 -0500

I don't believe this exists.

I haven't checked, but I also don't believe you can access the Publishers used by TF, as it's an internal piece of infrastructure.

Thinking about it I'm also not sure this would really "work": TF not only cares about the current state, but also about transforms in the past. How would a current client get values from the past if the broadcaster hasn't actually computed nor broadcast them?

You could of course reason that for special clients aware of this limitation, this could be handled by some custom code, but that would make the whole setup rather brittle (only need one non-adapted client to start failing, need to update all clients, etc).

And something to realise:

If I was just publishing into a topic I could use the method getNumSubscribers().

That would only tell you there is some entity subscribing to the topic, not whether they are actually processing the messages.

Assuming reception == processing is not a valid thing to do and you have no way of knowing for sure. That's one of the characteristics of publish-subscribe.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2020-10-20 18:29:04 -0500

Seen: 525 times

Last updated: Oct 21 '20