Ask Your Question
0

bag file is empty after rosbag reindexing and fixing .bag.active file

asked 2018-09-03 02:51:14 -0500

Lucas02 gravatar image

updated 2018-09-04 02:58:36 -0500

Hello everyone!

I'm trying to convert .bag.active file into .bag file so I can play it inside rqt_bag program. The thing is, I tried to follow this steps which is to:

  1. rosbag reindex the .bag.active file, and then
  2. rosbag fix .bag.active file into .bag file

I do get the message that Bag migration is successful. after running rosbag fix, but when trying rosbag play it says that there are 0 messages to play.

Someone else also asked this question, but there are no answers, so I'm trying again, maybe you can help me.

EDIT: To anybody else reading this question, to recap:

  1. run rosbag record with --chunksize=<some_number> option. <some_number> should be a number which is appropriate for how much data in KB you are sending and/or receiving.
  2. run rosbag reindex <your_bag_active_file>, e.g. rosbag reindex myfile.bag.active
  3. run rosbag fix <your_bag_active_file> <new_bag_file_name>, e.g. rosbag fix myfile.bag.active mybagfile.bag
edit retag flag offensive close merge delete

Comments

What is the size of the bag before you fix it?

Reamees gravatar imageReamees ( 2018-09-03 03:48:22 -0500 )edit

.bag.active file is 528,4 kB and .bag file after reindex and fix is 4,1 kB.

Lucas02 gravatar imageLucas02 ( 2018-09-03 04:09:44 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-09-03 05:43:07 -0500

Reamees gravatar image

There probably is no actual data in the bag file. I was able to reproduce the problem by terminating the bag in a "not polite way" before the bag had reached the "chunksize". (768kB according to the wiki).

From the wiki:

--chunksize=SIZE

Advanced. Record to chunks of SIZE KB (Default: 768). This is a buffer within the bag file object. Lowering this value will result in more writes to disk.

So I guess anything still in the buffer when the process dies unexpectedly is lost. If you need to work with such small amounts of data and the application is prone to cause recording to crash then you could lower the chunksize.

edit flag offensive delete link more

Comments

Ah okay, will try this if it works.

Lucas02 gravatar imageLucas02 ( 2018-09-03 07:27:04 -0500 )edit

Try it and if it helps you sometimes recover some data then great. In the end it would be best to minimize the need to fix your bags afterward, shutting down the recording of the bag gently, e.g pressing ctrl+c.

Reamees gravatar imageReamees ( 2018-09-03 08:15:27 -0500 )edit

I can confirm that this works beautifully. Thank you!

Lucas02 gravatar imageLucas02 ( 2018-09-04 02:40:47 -0500 )edit

Good! Thanks for accepting the answer! It would also be good to keep in mind that reducing the chunksize has some implications. If you start getting more data at some point it might be too much overhead and might cause problems.

Reamees gravatar imageReamees ( 2018-09-04 04:31:35 -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

3 followers

Stats

Asked: 2018-09-03 02:51:14 -0500

Seen: 828 times

Last updated: Sep 04 '18