Ask Your Question

How to play bagfile from a specific point( i.e not from start of the bagfile)?

asked 2013-09-25 20:31:23 -0500

Bindu gravatar image

updated 2013-09-25 20:31:46 -0500

My Bag file is taken from lidar and that file contains the following information.

    path:        file2.bag
    version:     2.0
    duration:    3:47s (227s)
    start:       Nov 08 2012 16:19:48.77 (1352371788.77)
    end:         Nov 08 2012 16:23:36.39 (1352372016.39)
    size:        1.6 GB
    messages:    28305
    compression: none [1847/1847 chunks]
    types:       augv_msgs/InertialData     [757c72354c42518ae68ece93194dc095]
    gps_common/GPSFix          [3db3d0a7bc53054c67c528af84710b70]
    sensor_msgs/Image          [060021388200f6f0f447d0fcd9c64743]
    velodyne_msgs/VelodyneScan [50804fc9533a0e579e6322c04ae70566]
    topics:      /GPSFix                  11383 msgs    : gps_common/GPSFix         
                 /InertialData            11383 msgs    : augv_msgs/InertialData    
                 /basler_node/image_raw    2590 msgs    : sensor_msgs/Image         
                 /velodyne_packets         2949 msgs    :velodyne_msgs/VelodyneScan

/GPSFIX contains Latitude and longitude informations. I want to play the bag file from specific latitude and logitude value. How should i do this?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2013-09-25 22:52:19 -0500

You can start playing file from specific time with parameter -s, but you will have to find this time yourself. It can be done either manually or via rosbag API. Basically, you will have to iterate through all the messages and test them against necessary conditions, e.g. GPS coordinates. For this kind of tasks I personally prefer Python, but there is C++ API as well. You can find some code snippets here.

For details on rosbag play commandline usage, please see rosbag/Commandline/play.

edit flag offensive delete link more

answered 2013-09-25 22:57:30 -0500

Procópio gravatar image

I would suggest that you filter your bag file, using your desired latitude/longitude as arguments for the filter, and then play the new bag file. more info on how to filter bag files, can be found in this question, for example.

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-09-25 20:31:23 -0500

Seen: 4,093 times

Last updated: Sep 25 '13