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

how can rosbag write so fast on disk?

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

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?

Thanks.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
11

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

Patrick Mihelich gravatar image

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

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 http://www.ros.org/wiki/Bags/Format/2.0.

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

Comments

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

Question Tools

Stats

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

Seen: 1,679 times

Last updated: Feb 10 '12