tf_remove_frames.py
Go to the documentation of this file.
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 
4 # Copyright 2016 The Cartographer Authors
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 # http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 
18 import rospy
19 from tf.msg import tfMessage
20 
21 
22 def main():
23  rospy.init_node('tf_remove_frames')
24  publisher = rospy.Publisher('/tf_out', tfMessage, queue_size=1)
25  remove_frames = rospy.get_param('~remove_frames', [])
26 
27  def callback(msg):
28  msg.transforms = [
29  t for t in msg.transforms
30  if t.header.frame_id.lstrip('/') not in remove_frames and
31  t.child_frame_id.lstrip('/') not in remove_frames
32  ]
33  publisher.publish(msg)
34 
35  rospy.Subscriber('/tf_in', tfMessage, callback)
36  rospy.spin()
37 
38 
39 if __name__ == '__main__':
40  main()


cartographer_ros
Author(s):
autogenerated on Mon Jun 10 2019 12:59:40