test_prior_rename_kinect_bag_tf.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 import rosbag
3 from tf.msg import tfMessage
4 with rosbag.Bag('rgbd_dataset_freiburg3_long_office_household_tf_renamed.bag', 'w') as outbag:
5  for topic, msg, t in rosbag.Bag('rgbd_dataset_freiburg3_long_office_household.bag').read_messages():
6  if topic == "/tf" and msg.transforms:
7  newList = [];
8  for m in msg.transforms:
9  if m.child_frame_id != "/kinect":
10  newList.append(m)
11  else:
12  m.child_frame_id = "/kinect_gt"
13  newList.append(m)
14  print 'kinect frame renamed!'
15  if len(newList)>0:
16  msg.transforms = newList
17  outbag.write(topic, msg, t)
18  else:
19  outbag.write(topic, msg, t)


rtabmap_ros
Author(s): Mathieu Labbe
autogenerated on Mon Dec 14 2020 03:42:19