Skip to content

Record and play back data from Kinect Realsense with rosbag

jianqiaol edited this page Feb 24, 2016 · 6 revisions

Kinect

1.To start using kinect, open a terminal and run

  $ roslaunch kinect2_bridge kinect2_bridge.launch

This will let ROS system start getting data from kinect. You should see the system starts and stops with "waiting for clients to connect".

2.To view the point cloud, open a new terminal. Run

$ rosrun kinect2_viewer kinect2_viewer sd cloud

And you will see a new window pop up with a point cloud view. Here's link explaining the parameters for kinect2_viewer function: https://github.com/code-iai/iai_kinect2/tree/master/kinect2_viewer

3.To record the data,in a new terminal run

$ rosbag record -0 name.bag -a

Here "-a" means you will subscribe to all available ros topics and record data from them. After you think the data is enough you can stop it by ctrl-C. The data will be stored in a .bag file, here name.bag. More settings can be found here:http://wiki.ros.org/rosbag/Commandline#record

4.To play back the data, you need to stop the program in the first terminal (the launch file). Then you run

$ roscore

This will start a ROS server. Then in the other terminal, run

$ rosbag play name.bag

This will let ROS system play back the data you just recorded as if the device is still working. You can then use kinect2_viewer to see the data.

Useful links:

ROSBAG

ROSCORE

Kinect2 Driver

Clone this wiki locally