Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The reason was tf2_ros::StaticTransformBroadcaster has a ros::publisher to publish transforms.

In the first case tf2_ros::StaticTransformBroadcaster staticBroadcaster2 go out of scope , all the callback will be stopped being callded, which is not the case for second one.


From ros::Publisher Class Reference

Once all copies of a specific Publisher go out of scope, any subscriber status callbacks associated with that handle will stop being called. Once all Publishers for a given topic go out of scope the topic will be unadvertised.