ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

rosbag file cannot be made //

asked 2012-07-29 22:32:53 -0600

allelujah-wang gravatar image

Hello, guys! When I was using the rosbag tool to record the real data for our robot, I used the command : rosbag record -a when the whole mission was accomplished, there was no .bag file made in that folder. Instead, there was a file was made in that folder. However, when I want to replay the data, the "rosbag play " command cannot read the file, which made it impossible to analysis the data. I cannot find a proper answer from the pages, so I hope you guys can help me. THX

edit retag flag offensive close merge delete


The file is big, about 3.5GB each round. I started the rosbag at the very beginning. @ Lorenz

allelujah-wang gravatar image allelujah-wang  ( 2012-07-29 22:55:31 -0600 )edit

And how did you stop it? Just by pressing Ctrl-C and waiting or by killing it (e.g. Ctrl-\, or closing the window)?

Lorenz gravatar image Lorenz  ( 2012-07-30 10:30:03 -0600 )edit

I have the same issue. The mistake committed was that I closed the bag file using Ctrl+Z, instead of closing the bag file using Ctrl+C.

namanskumar gravatar image namanskumar  ( 2016-09-22 00:47:55 -0600 )edit

3 Answers

Sort by » oldest newest most voted

answered 2012-07-29 22:47:41 -0600

Lorenz gravatar image

I guess the rosbag process didn't shut down cleanly at the end. After recording, it might need to write an index so it must shut down cleanly.

How did you start rosbag? If you were using roslaunch and the bag file is big, it might happen that roslaunch kills rosbag after 10 seconds.

edit flag offensive delete link more



Why is this answer accepted? It does not answer the question!

Marcel Usai gravatar image Marcel Usai  ( 2020-02-07 08:13:27 -0600 )edit

answered 2015-11-14 04:02:14 -0600

Roger Yau gravatar image

updated 2015-11-14 04:03:26 -0600

If a bag was not closed cleanly, then the index information may be corrupted. Two steps are needed to repair the bag:

$ rosbag reindex *

$ rosbag fix * repaired.bag

edit flag offensive delete link more


I tried repairing the bag as suggested and converted it to txt file using the following command

      rostopic echo –b file.bag /rostopic> filename2.txt

The filename2.txt file is empty without any data inside it.

Found repaired.bag is not having any data inside it.

namanskumar gravatar image namanskumar  ( 2016-09-22 00:45:24 -0600 )edit

thanks, it really work!

jiashiwei gravatar image jiashiwei  ( 2017-03-24 01:33:00 -0600 )edit

Thanks, its worked for me!

cesarhcq gravatar image cesarhcq  ( 2019-06-30 17:29:41 -0600 )edit

answered 2012-09-15 14:08:28 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

You may need to use rosbag fix or rosbag reindex to fix the bagfile if it shutdown while recording.

edit flag offensive delete link more

Question Tools



Asked: 2012-07-29 22:32:53 -0600

Seen: 23,434 times

Last updated: Nov 14 '15