Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

A poor workaround for this I'm using is to play the bag file with only the topics I want to keep and record them on a new bag file. Of course this only works for relatively short bag files.

In case this is useful to you, here is a way to get the list of topics from the original bag file:

topics=`rosbag info original.bag | grep "^topics" -A 9999 | grep -o '\(/[^ ]*\)\{2\}' | grep -v undesired_topic`
rosbag play original.bag --topics $topics

A poor workaround for this I'm using is to play the bag file with only the topics I want to keep and record them on a new bag file. Of course this only works for relatively short bag files.

In case this is useful to you, here is a way to get the list of topics from the original bag file:

topics=`rosbag info original.bag | grep "^topics" -A 9999 | grep -o '\(/[^ ]*\)\{2\}' ' /[^ ]*' | cut -c 2- | grep -v undesired_topic`
rosbag play original.bag --topics $topics

EDIT: The grep regex was faulty.