ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
17

can "rosbag filter" create a new bag file with multiple topics within it?

asked 2014-08-22 10:44:28 -0600

mister_kay gravatar image

Hello,

I have a bagfile with a lot of topics in it. For some reason I would like to filter out 4 topics of that bagfile into a new bagfile:

   rosbag filter old_bag.bag new_bag.bag "topic=='/stereo/left/image_rect' '/stereo/right/image_rect' '/stereo/left/camera_info'  '/stereo/right/camera_info'"

Unfortunately this doesn't work. Does anyone have a clue what the correct syntax is?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
37

answered 2014-08-22 10:46:30 -0600

Tom Moore gravatar image

updated 2021-11-14 08:49:35 -0600

lucasw gravatar image

The filter statement is just python, so you can use or:

rosbag filter old_bag.bag new_bag.bag "topic == '/stereo/left/image_rect' or topic == '/stereo/right/image_rect' or topic == '/stereo/left/camera_info' or topic == '/stereo/right/camera_info'"
edit flag offensive delete link more

Comments

11

If you want to record a whole namespace, e.g., "stereo", you can make use of Python's in operator:

rosbag filter old_bag.bag new_bag.bag "'stereo' in topic"
Benjamin Blumer gravatar image Benjamin Blumer  ( 2017-06-30 13:56:14 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2014-08-22 10:44:28 -0600

Seen: 31,163 times

Last updated: Nov 14 '21