1
$\begingroup$

Rosanswers logo

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?


Originally posted by mister_kay on ROS Answers with karma: 238 on 2014-08-22

Post score: 17

$\endgroup$

1 Answer 1

1
$\begingroup$

Rosanswers logo

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'"

Originally posted by Tom Moore with karma: 13689 on 2014-08-22

This answer was ACCEPTED on the original site

Post score: 37


Original comments

Comment by Benjamin Blumer on 2017-06-30:
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"
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.