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

how can rosbag write so fast on disk?

asked 2012-02-10 05:55:58 -0500

sciarp gravatar image

Hi there!

I made some test and I discovered that rosbag is able to record information at an impressive speed (I sent through the network several images (500x250 mono8) at ~29 MBps) and rosbag didn't miss anything. What are the techniques used by rosbag to make this possible?


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2012-02-10 06:20:06 -0500

Patrick Mihelich gravatar image

updated 2012-02-10 06:21:01 -0500

Nodes receive messages as serialized data buffers over sockets. Normally the client library deserializes that buffer, copying all the data fields from that buffer into some language-appropriate message object.

rosbag treats messages a bit differently. When it receives one, it skips the deserialization step and instead copies the data buffer to the end of the bag file it's writing. The bag file has a linear structure - it's basically all the serialized messages written out to disk sequentially. The current format is documented at

Since rosbag writes all the data sequentially, no seeks (which negatively affect I/O performance) are required. So rosbag should be able to hit the max "buffer-to-disk" data transfer rate, which is typically around 1030 Mbits/sec.

edit flag offensive delete link more


Thank you for the very quick and detailed reply ;)
sciarp gravatar image sciarp  ( 2012-02-10 06:52:26 -0500 )edit

Question Tools


Asked: 2012-02-10 05:55:58 -0500

Seen: 1,607 times

Last updated: Feb 10 '12