Ask Your Question
1

Merging rosbag files and removing gaps of no messages

asked 2017-08-17 05:08:39 -0500

vkee gravatar image

I have several bags recorded of navigating through an environment, with pauses between each bag from configuring the system. I would like to playback the entire sequence as one smooth continuous sequence. I merged the bags using https://gist.github.com/NikolausDemme... but there are large time gaps with no ROS messages in the merged bag as seen in the rqt_bag screenshot below.

RQT Bag Screenshot

Is there any easy way to remove these timegaps?

Thanks!

edit retag flag offensive close merge delete

Comments

I think this would require rewriting the timestamps of all involved msgs across all topics.

Doable, but I'm not aware of a tool that can do this OoB.

The scripts you link by Nikolaus could offer some inspiration for how to approach this.

gvdhoorn gravatar image gvdhoorn  ( 2017-08-17 06:16:24 -0500 )edit

Ah okay, I was hoping to not have to do this.

vkee gravatar image vkee  ( 2017-08-17 06:35:41 -0500 )edit

Well it could be that someone already wrote something for this, but I'm just not aware of it. That's why I commented instead of answering.

Let's see if other board members can come up with something.

But I believe that whatever tool you end up using, it will involve rewriting timestamps.

gvdhoorn gravatar image gvdhoorn  ( 2017-08-17 06:37:30 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
3

answered 2017-08-17 19:55:11 -0500

Ed Venator gravatar image

I would like to playback the entire sequence as one smooth continuous sequence.

rosbag play has an option --skip-empty. You specify a maximum gap length in seconds, and it will skip any gaps longer than that. So if you run rosbag play --skip-empty=1.0, rosbag will jump ahead in time instantly whenever it encounters a gap longer than 1 second.

edit flag offensive delete link more

Comments

--skip-empty does skip gaps, but I'm wondering whether it fulfils the

playback the entire sequence as one smooth continuous sequence

wish of the OP.

gvdhoorn gravatar image gvdhoorn  ( 2017-08-18 01:32:57 -0500 )edit
1

@Ed Venator, thanks a lot, this works perfect for me! Strange that this is not in the documentation for rosbag though ( http://wiki.ros.org/rosbag/Commandlin... .

vkee gravatar image vkee  ( 2017-08-18 07:47:43 -0500 )edit

The ROS wiki is often out of date and incomplete. I found the option with rosbag play --help

Ed Venator gravatar image Ed Venator  ( 2017-08-18 19:13:07 -0500 )edit

@vkee: the wiki is dependent on users like you to keep it up to date. It isn't an automatically generated resource.

It would be great if you could edit the page to include the --skip-empty option (and any other missing options).

gvdhoorn gravatar image gvdhoorn  ( 2017-08-19 05:15:06 -0500 )edit

@Ed Venator, I am running into issues using this command. When I handle the messages in a node callback, I am getting the following issue which kills my node:

munmap_chunk(): invalid pointer: 0x00007fffd47a33f0

I am guessing this is related to skipping (as I never had this issue before). Any idea?

vkee gravatar image vkee  ( 2017-08-21 04:21:29 -0500 )edit

I've never run into that particular error. It looks like a memory corruption error. What node is throwing that?

Ed Venator gravatar image Ed Venator  ( 2017-08-22 22:14:35 -0500 )edit

The node with the callback that handles messages from the bag. It never has that issue if I don't run it with the skip option so I'm wondering if it has to do with the skipping.

vkee gravatar image vkee  ( 2017-08-23 02:27:15 -0500 )edit

Without knowing what code's running in that node, I can't say. If it's doing something with time, it's possible that it can't handle large jumps in Ros Time.

Ed Venator gravatar image Ed Venator  ( 2017-08-23 14:06:39 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2017-08-17 05:08:39 -0500

Seen: 769 times

Last updated: Aug 17 '17