Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 import rospy
00020 from tf.msg import tfMessage
00021
00022
00023 def main():
00024 rospy.init_node('tf_remove_child_frames')
00025 remove_frames = rospy.get_param('~remove_frames', [])
00026
00027
00028 tf_pub = rospy.Publisher('tf_out', tfMessage, queue_size=1)
00029
00030 def tf_cb(msg):
00031 msg.transforms = [t for t in msg.transforms
00032 if t.child_frame_id.lstrip('/') not in remove_frames]
00033 tf_pub.publish(msg)
00034
00035 rospy.Subscriber('tf_in', tfMessage, tf_cb)
00036
00037
00038 tf_static_pub = rospy.Publisher('tf_static_out', tfMessage, queue_size=1, latch=True)
00039
00040 def tf_static_cb(msg):
00041 msg.transforms = [t for t in msg.transforms
00042 if t.child_frame_id.lstrip('/') not in remove_frames]
00043 tf_static_pub.publish(msg)
00044
00045 rospy.Subscriber('tf_static_in', tfMessage, tf_static_cb)
00046
00047 rospy.spin()
00048
00049
00050 if __name__ == '__main__':
00051 main()