ros2 / rosbag2

Apache License 2.0
272 stars 244 forks source link

Content-based filtering #885

Open imstevenpmwyca opened 2 years ago

imstevenpmwyca commented 2 years ago

Description

Something similar to what this does in ros1: rosbag filter mappingData_input.bag mappingData_output.bag 'topic != "/tf" or topic == "/tf" and m.transforms[0].header.frame_id != "map" and m.transforms[0].child_frame_id != "odom"'

Completion Criteria

After filtering a bag with a tf that has map->odom->base we get a new bag with a tf that has only odom->base

emersonknapp commented 2 years ago

More generically I think I would call this feature "content-based filtering". This would involve the converter feature, but also needs the ability to provide an arbitrary python expression.

I think, though, that you should currently be able to do this via a small Python script using the rosbag2_py API.

imstevenpmwork commented 2 years ago

For those who might be interested, I quickly did a script for the original issue using the rosbag2_py API as suggested. It is probably not the best, but it does the job. https://github.com/imstevenpmwork/filter_tf_topic_from_bag

fujitatomoya commented 2 years ago

related to https://github.com/ros2/design/pull/282