ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

How to filter rosbag of LaserScan and tf based on travelled distance?

asked 2013-10-28 17:13:47 -0500

cognitiveRobot gravatar image

Hi there,

I need ur help. I recorded a rosbag which contains LaserScan and tf for gmapping. How can i filter out some LaserScan and tf based on robot's travelled distance(or distance between two consecutive scanning point)?

Regards Hossain

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2013-11-10 19:46:18 -0500

Artem gravatar image

The other option is to create a filtered bag file that only contains those topics that you are interested. See

So basically, you have to list all topics and messages that you want to keep.

A quick example

rosbag filter <your bagfile> filtered_bag.bag 'topic == "/robot/topic1" and  topic == "/robot/topic2"''
edit flag offensive delete link more


hi Art and Tfoote, thanks. I don't want to filter topics instead i want to filter data from same topic. e.g. i want to save laserScan only when robot moves 50 cm from previous scanning point. any thoughts?

cognitiveRobot gravatar image cognitiveRobot  ( 2013-11-11 14:50:34 -0500 )edit

answered 2013-11-10 19:29:27 -0500

tfoote gravatar image

You can write a script to iterate over the messages in the bag and do whatever filtering you want. See the rosbag Code API

edit flag offensive delete link more

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


Asked: 2013-10-28 17:13:47 -0500

Seen: 378 times

Last updated: Nov 10 '13