Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import rosbag
from tf.msg import tfMessage
with rosbag.Bag('output.bag', 'w') as outbag:
for topic, msg, t in rosbag.Bag('input.bag').read_messages():
if topic == "/tf" and msg.transforms:
newList = [];
for m in msg.transforms:
if m.header.frame_id != "map":
newList.append(m)
else:
print 'map frame removed!'
if len(newList)>0:
msg.transforms = newList
outbag.write(topic, msg, t)
else:
outbag.write(topic, msg, t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.