20 from tf.msg
import tfMessage
24 rospy.init_node(
'tf_remove_child_frames')
25 remove_frames = rospy.get_param(
'~remove_frames', [])
28 tf_pub = rospy.Publisher(
'tf_out', tfMessage, queue_size=1)
31 msg.transforms = [t
for t
in msg.transforms
32 if t.child_frame_id.lstrip(
'/')
not in remove_frames]
35 rospy.Subscriber(
'tf_in', tfMessage, tf_cb)
38 tf_static_pub = rospy.Publisher(
'tf_static_out', tfMessage, queue_size=1, latch=
True)
40 def tf_static_cb(msg):
41 msg.transforms = [t
for t
in msg.transforms
42 if t.child_frame_id.lstrip(
'/')
not in remove_frames]
43 tf_static_pub.publish(msg)
45 rospy.Subscriber(
'tf_static_in', tfMessage, tf_static_cb)
50 if __name__ ==
'__main__':