Recording rosbag for kinect data (buffer error)

2,650 views
Skip to first unread message

AlexR

unread,
Dec 14, 2014, 9:26:33 AM12/14/14
to ros-by-...@googlegroups.com
Dear Patrick,

I am facing the following errors when I am trying to record the bag files for kinect data. 

When I run 
$ rosbag record -O ~/catkin_ws/src/rbx1/rbx1_nav/bagfiles/data_14dec14.bag camera/depth_registered/image camera/depth_registered/camera_info camera/rgb/image_color camera/rgb/camera_info /tf /cmd_vel /pose /scan /depthimage_to_laserscan

I always get the error about buffer exceed
 [ WARN] [13436234752.365353563]: rosbag record buffer exceeded.  Dropping oldest queued message.
I have sufficient space on my hard-disk and using 6gb of RAM on i5 processor 2.3 GHz (Ros Hydro 12.04 ). What are the good examples of saving bag files when saving kinect point clouds and camera images. I was doing navigation with table top manipulation and wanted to store the data.

Thank you

Alex

Patrick Goebel

unread,
Dec 14, 2014, 11:21:53 AM12/14/14
to ros-by-...@googlegroups.com
Hi Alex,

First, be sure you are recording the bag file on the same machine that is attached to the Kinect.  Recording to another machine over a wireless connection is bound to get bogged down.

A good place to start is this Wiki page on recording data from a Kinect although it hasn't been updated in awhile.  The trick appears to be to record the raw data topics for rgb an depth images since the pointclouds can be reconstructed on the fly during playback.  Pay particular attention to the depth registration parameter during recording and the publish_tf parameter during playback as follows.

Try these steps to record your bag file:

$ rosparam set use_sim_time false

$ roslaunch openni_launch openni.launch depth_registration:=true

$ rosbag record -O ~/catkin_ws/src/rbx1/rbx1_nav/bagfiles/data_14dec14.bag camera/depth_registered/image_raw camera/depth_registered/camera_info camera/rgb/image_raw camera/rgb/camera_info /tf /cmd_vel /pose /scan /depthimage_to_laserscan

Then for playback.  First Ctrl-C out of your openni_launch file so that the camera driver is no longer running.  Then:

$ rosparam set use_sim_time true

$ roslaunch openni_launch openni.launch load_driver:=false publish_tf:=false

This launches an openni node without the camera driver and without publishing camera transforms which you have already captured in your bag file.  The openni_node does the magic of converting your recorded raw image topics to pointclouds on the fly.

If you want to see the pointcloud during playback, bring up RViz with a PointCloud2 display and listen to the topic /camera/depth_registered/points.  For example, you could use:

$  rosrun rviz rviz -d `rospack find rbx1_vision`/pcl.rviz

And then change the Original Point Cloud topic to /camera/depth_registered/points.

Now play back your file:

$ rosbag play --clock ~/catkin_ws/src/rbx1/rbx1_nav/bagfiles/data_14dec14.bag

Let us know if that works for you!

--patrick

AlexR

unread,
Dec 15, 2014, 2:53:17 AM12/15/14
to ros-by-...@googlegroups.com
Dear Patrick,

The image_raw topic has been recorded fine but with certain lags. However, I cannot get the point cloud to be displayed. I am using the openni2_launch with Asus Xtion Pro Live instead of kinect. When I click the topic as /camera/depth_registered/points under Orgininal Points in rviz nothing shows up. 
Also for a 10 sec bag record the file is 560 MB which is too big. 

Thanks
Alex

Patrick Goebel

unread,
Dec 18, 2014, 9:45:38 AM12/18/14
to ros-by-...@googlegroups.com
Hi Alex,

I spent several hours trying to figure this out (mostly by trial and error since documentation seems to be rather hit and miss) and I'm afraid I still don't have a good answer for you.  The best way to reduce the size of the bag file is to use the compressed image topics (/camera/depth_registered/image_raw/compressedDepth and /camera/rgb/image_raw/compressed).  However, while these images record and play fine with image_view, I cannot get them to show in RViz.  (This would be a good question for http://answers.ros.org.)

A couple of other strategies to reduce bag size is:
  1.  Reduce the resolution of your camera using rqt_reconfigure.  The default resolution is VGA (640x480) so try reducing it to QVGA (324x240) which should reduce the bag size by a factor of 4.  I rarely need a higher resolution than QVGA for most vision tasks.

  2. Use the data_skip parameter for the camera driver to reduce the effective frame rate.  For example, the command:

    $ rosrun dynamic_reconfigure dynparam set /camera/driver data_skip 5

    will drop every 5th frame and so reduce the frame rate by 20%.  To cut the frame rate in half, try setting the data_skip to 2.  You can also change this parameter using rqt_reconfigure.

  3. As for the point cloud not showing up in RViz during playback, I get the same result if I use openni2 during playback.  Instead, try using openni2 for record (I assume you have a later version Xtion Pro that doesn't work with openni 1?) but use openni 1 for playback.

--patrick

Reply all
Reply to author
Forward
0 new messages