rosbag record over network

asked 2019-09-09 07:03:51 -0600

mun gravatar image

updated 2019-09-09 07:09:12 -0600


Is it recommended or common to record bags over a network? That is to store the bag file on a machine within the local network. Suppose the robot recording the bag was connected to the network over WiFi, would there be sufficient bandwidth for bag recording though? Suppose the resolution is 640x480 at 30fps.

edit retag flag offensive close merge delete


It really depends on your network and the rate at which you're trying to record data into your rosbag. The compressed rosbag structure will take up less space than the original topics, so it should be more bandwidth efficient to run rosbag record on your robot and the save the file to a network drive, than it would for rosbag to subscribe to the same topics over the network.

If you can tell us a bit more about your setup and what types of topics you need to record and we can let you know if it's realistic or not.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2019-09-09 07:10:45 -0600 )edit

@PeteBlackerThe3rd Thanks. I was thinking to record the minimal needed for a XYZRGB point cloud, thus these topics: camera/depth_registered/image_raw camera/depth_registered/camera_info camera/rgb/image_raw camera/rgb/camera_info

My reading is that camera/depth_registered/image_raw is 2 bytes per pixel and camera/rgb/image_raw is 1 byte per pixel. At 640 x 480 @30fps, that's 26MB/s. Not sure how much camera_info needs. For 802.11n, perhaps that's a bit too much?

mun gravatar image mun  ( 2019-09-09 07:19:45 -0600 )edit

camaera/rgb/image_raw will be 3 bytes per pixel, one each for red, green and blue. You really want to use the compressed version of these topics if you're sending the data over a wi-fi network. The last time I checked there isn't any compression support for 16 bit mono (i.e. depth) images in ROS.

rosbag can use zip compression as it creates a bag file though. You can test this by recording a short test bag on your robot and then calculating it's data rate. This will give you a good idea if it's possible to stream over your wi-fi.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2019-09-09 08:48:09 -0600 )edit

I'm giving it a try now, but I'm not sure if I'm doing it right. Am I meant to run roscore on the network machine, set ROS_MASTER_URI to http://ip:11311 and run the camera driver and rosbag record on the robot? Strangely I'm not getting any recording though.

mun gravatar image mun  ( 2019-09-09 12:15:43 -0600 )edit

Regarding your issue of not getting any recording you might take a look at the ROS NetworkSetup tutorial.

From your brief problem description I am guessing that there might be no full two way connectivity. You can easily check that by trying to subscribe to one topic published on your remote master from the command line. If this does not work either you know it is a network issue. In order to record bag files or more generally subscribe to topics published on a remote machine, the hostnames of all participating machines have to be resolvable.

While setting ROS_MASTER_URI is sufficient to view all available topics, it might be also necessary to export ROS_IP=<IP Address> on the local PC you are using for recording the bagfile.

A different option would be setting ROS_HOSTNAME explicitly on you local machine and add the host name to /etc/hosts file on the ...(more)

Phgo gravatar image Phgo  ( 2019-09-10 02:28:07 -0600 )edit

I've got it working now. The network connection is definitely not good enough...

mun gravatar image mun  ( 2019-09-12 02:22:02 -0600 )edit