Created
August 8, 2016 14:43
-
-
Save matlabbe/477901e5b7c3d00a0f5aee2f3d78c155 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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