tf_remove_frames.py
Go to the documentation of this file.
00001 #!/usr/bin/python
00002 # -*- coding: utf-8 -*-
00003 
00004 # Copyright 2016 The Cartographer Authors
00005 #
00006 # Licensed under the Apache License, Version 2.0 (the "License");
00007 # you may not use this file except in compliance with the License.
00008 # You may obtain a copy of the License at
00009 #
00010 #    http://www.apache.org/licenses/LICENSE-2.0
00011 #
00012 # Unless required by applicable law or agreed to in writing, software
00013 # distributed under the License is distributed on an "AS IS" BASIS,
00014 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015 # See the License for the specific language governing permissions and
00016 # limitations under the License.
00017 
00018 import rospy
00019 from tf.msg import tfMessage
00020 
00021 
00022 def main():
00023   rospy.init_node('tf_remove_frames')
00024   publisher = rospy.Publisher('/tf_out', tfMessage, queue_size=1)
00025   remove_frames = rospy.get_param('~remove_frames', [])
00026 
00027   def callback(msg):
00028     msg.transforms = [
00029         t for t in msg.transforms
00030         if t.header.frame_id.lstrip('/') not in remove_frames and
00031         t.child_frame_id.lstrip('/') not in remove_frames
00032     ]
00033     publisher.publish(msg)
00034 
00035   rospy.Subscriber('/tf_in', tfMessage, callback)
00036   rospy.spin()
00037 
00038 
00039 if __name__ == '__main__':
00040   main()


cartographer_ros
Author(s): The Cartographer Authors
autogenerated on Wed Jul 10 2019 04:10:28