Ask Your Question
13

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

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

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
28

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

Tom Moore gravatar image

updated 2014-08-22 10:47:44 -0500

The filter statement is just python, so you can do

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

6

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 imageBenjamin Blumer ( 2017-06-30 13:56:14 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

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

Seen: 14,607 times

Last updated: Aug 22 '14