How can I access all static TF2 transforms?
I have two nodes who each publish a single static TF2 transform (each with a different child frame) via tf2_ros.StaticTransformBroadcaster.sendTransform upon startup. These are essentially configuration-based transforms; they never change for the entire roscore session. When I later go to read/use these transforms, only one of the two is available (the one which happened to be published second). How can I get access to both of them?
It seems that the StaticTransformBroadcaster merely publishes a tf2_msgs/TFMessage to /tf_static, and by the nature of topics, any previously-latched message is thereby destroyed for future subscribers of that topic. I would have expected StaticTransformBroadcaster to do something more sophisticated -- like: 1) subscribe to /tf_static and receive any existing latched TFMessage 2) whenever a new transform is sent (via StaticTransformBroadcaster.sendTransform), append the new transform to the existing transforms on the latched message it had already received and then 3) publish the union TFMessage to the topic. I suppose I can write this myself, but what is the anticipated use case for the existing StaticTransformBroadcaster? Use only in systems with a single place that ever publishes static transforms, and only ever publishes all static transforms at once? That seems very narrow and I don't see any documentation regarding these limitations apart from reading the source code.
Here is a complete Python script to demo the issue:
import rospy
import tf2_ros
import geometry_msgs.msg
rospy.init_node('tf_test')
br = tf2_ros.StaticTransformBroadcaster()
t = geometry_msgs.msg.TransformStamped()
t.header.stamp = rospy.Time.now()
t.header.frame_id = "world"
t.child_frame_id = "static_camera1"
t.transform.translation.z = 1
t.transform.rotation.w = 1
br.sendTransform(t)
br2 = tf2_ros.StaticTransformBroadcaster()
t2 = geometry_msgs.msg.TransformStamped()
t2.header.stamp = rospy.Time.now()
t2.header.frame_id = "world"
t2.child_frame_id = "static_camera2"
t2.transform.translation.x = 1
t2.transform.rotation.w = 1
br2.sendTransform(t2)
rospy.spin()
With that script running, start RViz and add TF. Observe that only static_camera2 is visible and static_camera1 is hidden. Confirm that the information for static_camera1 is not present in the topic with
rostopic echo /tf_static