Robotics StackExchange | Archived questions

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

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

Asked by cognitiveRobot on 2013-10-28 17:13:47 UTC

Comments

Answers

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

Asked by tfoote on 2013-11-10 20:29:27 UTC

Comments

The other option is to create a filtered bag file that only contains those topics that you are interested. See http://wiki.ros.org/rosbag/Tutorials/Producing%20filtered%20bag%20files

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

Asked by Artem on 2013-11-10 20:46:18 UTC

Comments

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?

Asked by cognitiveRobot on 2013-11-11 15:50:34 UTC