test_prior_rename_kinect_bag_tf.py
Go to the documentation of this file.
00001 #!/usr/bin/env python 
00002 import rosbag
00003 from tf.msg import tfMessage
00004 with rosbag.Bag('rgbd_dataset_freiburg3_long_office_household_tf_renamed.bag', 'w') as outbag:
00005         for topic, msg, t in rosbag.Bag('rgbd_dataset_freiburg3_long_office_household.bag').read_messages():
00006                 if topic == "/tf" and msg.transforms:
00007                         newList = [];
00008                         for m in msg.transforms:
00009                                 if m.child_frame_id != "/kinect":
00010                                         newList.append(m)
00011                                 else:
00012                                         m.child_frame_id = "/kinect_gt"
00013                                         newList.append(m)
00014                                         print 'kinect frame renamed!'
00015                         if len(newList)>0:
00016                                 msg.transforms = newList
00017                                 outbag.write(topic, msg, t)
00018                 else:
00019                         outbag.write(topic, msg, t)


rtabmap_ros
Author(s): Mathieu Labbe
autogenerated on Thu Jun 6 2019 21:30:49