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

Revision history [back]

click to hide/show revision 1
initial version

My answer is pretty redundant coming three years late, but for anyone else who asks this another option is to use the rosbag filter command, e.g.

rosbag filter input.bag output.bag "t.secs <= 1284703931.86"

You can use the standard greater-than-or-equal-to (>=) and less-than-or-qual-to (<=) operators to keep all data before or after your cutoff point. Keep in mind that ROS time-stamps each message with the absolute time in seconds, rather than the time of the message relative to the start of the record. So you'll need to find the start and end times of your record and do a bit of basic math to find the 150 sec point.

For other filter commands, take a look at rosbag/Commandline

My answer is pretty redundant coming three years late, but for anyone else who asks this another option is to use the rosbag filter command, e.g.

rosbag filter input.bag output.bag "t.secs <= 1284703931.86"

You can use the standard greater-than-or-equal-to (>=) and less-than-or-qual-to (<=) operators to keep all data before or after your cutoff point. Keep in mind that ROS time-stamps each message with the absolute time in seconds, Unix time, rather than the time of the message relative to the start of the record. So you'll need to find the start and end times of your record and do a bit of basic math to find the 150 sec point.

For other filter commands, take a look at rosbag/Commandline