Skip to content

Instantly share code, notes, and snippets.

@michalpelka
Created August 22, 2018 23:12
Show Gist options
  • Save michalpelka/76a3168279b172cbc1bf6a577c031e29 to your computer and use it in GitHub Desktop.
Save michalpelka/76a3168279b172cbc1bf6a577c031e29 to your computer and use it in GitHub Desktop.
import rosbag
from tqdm import tqdm
from os.path import basename
bagFileName="3velo_2018-07-28-10-00-18_nocam.bag"
bagIn = rosbag.Bag(bagFileName, 'r')
bagOut = rosbag.Bag(basename(bagFileName)+"_noekf.bag", 'w')
tot = bagIn.get_message_count()
for topic, msg, t in tqdm(bagIn.read_messages(), total=tot):
if topic == '/tf':
#if len(msg.transforms) > 1:
# import pdb; pdb.set_trace()
#print msg.transforms[0].header.frame_id
if msg.transforms[0].header.frame_id == "husky/odom":
#import pdb; pdb.set_trace()
continue
bagOut.write(topic, msg, t)
bagIn.close()
bagOut.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment