# intermittent recording of Kinect inputs using rosbag

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

I'd like to record a bag file of Kinect data, which can be run on RGBDSLAM later, as is instructed here. Everything works perfectly, but for my own experiment I would like to record the bag files intermittently, instead of capturing a continuous stream from Kinect.

The purpose is to get data at a very low frequency(say, having a time interval of 10 seconds between 2 inputs), so that I can have a bag file which contains images and depth information from a long time period (20 minutes, for example) while keeping the minimal amount of necessary data. In other words, I would like to get a single frame every 10 seconds or so for the bag file.

I suppose I can do this in a pretty ugly way, which is to run openni_node.launch on and off in one terminal, with rosbag record -O running in another terminal. But that is actually capturing continuous input in an impulse of time and then stop it, instead of capturing one single frame(as we press "Enter" running the RGBDSLAM with the GUI).

As I am new to ROS, I don't know how to do this, and there seemed no related discussion on this issue. Any suggestion would be greatly appreciated!

edit retag close merge delete

1

Thanks piyushk for the info. Now it is working for online RGBDSLAM, but running offline produces nothing in the screen, even though I have modified the topic config in rgbdslam.launch. Any suggestion?

( 2012-08-16 20:46:59 -0500 )edit

Sort by » oldest newest most voted

You can use this node: http://www.ros.org/wiki/topic_tools/throttle

It takes in an arbitrary message topic and republishes the message at a desired rate. You can then record the republished message.

more

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

An alternative is to use the GUI from dynamic_reconfigure to set the data_skip parameter of openni_camera. It will only let you reduce the framerate to 3 Hz (and not 0.1 Hz, as you propose), but at 0.1 Hz you won't get any sensible output out of RGBDSLAM anyway (except if the robot is not moving at all in those 10 seconds).

The advantage of this over the topic_tools solution is that you turn down the publishing frequency at the source, so you save a little computation time. The downside is that all subscribers get the point clouds at low frequency.

more