Skip to content

Instantly share code, notes, and snippets.

@ayrton04
Last active March 21, 2022 11:18
Show Gist options
  • Save ayrton04/662964298a82211a7e28 to your computer and use it in GitHub Desktop.
Save ayrton04/662964298a82211a7e28 to your computer and use it in GitHub Desktop.
ROS rosbag filter command for filtering out specific tf transforms from your bag files
rosbag filter original.bag filtered.bag "topic != '/tf' or ((len(m.transforms) > 0 and m.transforms[0].header.frame_id != 'odom') and (len(m.transforms) <= 1 or (len(m.transforms) > 1 and m.transforms[1].header.frame_id != 'odom')) and (len(m.transforms) <= 2 or (len(m.transforms) > 2 and m.transforms[2].header.frame_id != 'odom')) and (len(m.transforms) <= 3 or (len(m.transforms) > 3 and m.transforms[3].header.frame_id != 'odom')) and (len(m.transforms) <= 4 or (len(m.transforms) > 4 and m.transforms[4].header.frame_id != 'odom')))"
@hashim19
Copy link

6 years later, worked like a charm. :)

@RoboEvangelist
Copy link

RoboEvangelist commented Mar 18, 2022

How do we filter list of topics?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment