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

Using tf_static for almost static transforms

asked 2016-02-16 13:34:56 -0500

Mellon gravatar image


I have a node that will define some TF frames at some points in time along the robot trajectory. They will be defined by transformations with /map as the frame_id. These transformations will eventually change later, but the frequency of change will be very very low, and basically event driven (whenever a loop closing happens).

I was wondering if in this case using /tf_static would be a good choice here, given the low frequency of updates on these transforms, even if the transformations are not constant. But I'm getting confused with the latching concept and the following text from the tf2 migration page:

It is expected that publishers on "/tf_static" publish using latched topics, the tf2_ros static_transform_publisher does this correctly. Note: avoid multiple latched static transform publishers on /tf_static in the same process, because with multiple latched publishers within the same node only one will latch correctly.

So, the first question is: is it possible to implement what I want using /tf_static?

If it is indeed possible, how should I implement it to make the latching work properly? Should I create a publisher every time I need to update one of the transforms, destroying it later? Or having only one that would publish everything on /tf_static would do?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-01-11 23:01:19 -0500

ahendrix gravatar image

I realize this is an old question, but it still deserves an answer.

The proper way to do this is to keep a single /tf_static publisher, and publish all of your transforms to it as a single message.

tf2_ros provides the StaticTransformBroadcaster class that manages a vector of transforms and manages the details for you. (calling sendTransform automatically adds the transforms you pass and publishes everything in a single message)

The reason to include all of your transforms in a single message is because latched topics in ROS only deliver the most recently published message to new subscribers, so that single message has to include everything you want to publish. (otherwise new subscribers won't get the whole system state)

edit flag offensive delete link more

Question Tools



Asked: 2016-02-16 13:34:56 -0500

Seen: 2,570 times

Last updated: Jan 11 '17