Tuesday, October 7, 2014

Grab Pointclouds and save as pcd files using ROS and Openni

1) Install ROS Hydro Openni2 packages:

$sudo apt-get install ros-hydro-openni2-camera ros-hydro-openni2-launch

2) Run ROS

$roscore

3) Launch openni

$roslaunch openni2_launch openni2.launch

4) Launch RViz

$rosrun rviz rviz

5) Do settings in RViz to receive data from Kinect

6) Back in terminal, use the following command to save the point clouds


$rosrun pcl_ros pointcloud_to_pcd input:=<your target topic name>
 
For ex:
$ rosrun pcl_ros pointcloud_to_pcd input:=/camera/depth_registered/points
The output is :

[ INFO] [1412698428.630599815]: Listening for incoming data on topic /camera/depth_registered/points
[ INFO] [1412698428.870419685]: Received 307200 data points in frame /camera_rgb_optical_frame with the following fields: x y z rgb
[ INFO] [1412698428.870483694]: Data saved to 1412698428747359.pcd
[ INFO] [1412698429.421970793]: Received 307200 data points in frame /camera_rgb_optical_frame with the following fields: x y z rgb
[ INFO] [1412698429.422065179]: Data saved to 1412698429281241.pcd
[ INFO] [1412698429.979569838]: Received 307200 data points in frame /camera_rgb_optical_frame with the following fields: x y z rgb
[ INFO] [1412698429.979637397]: Data saved to 1412698429848510.pcd
[ INFO] [1412698430.495591052]: Received 307200 data points in frame /camera_rgb_optical_frame with the following fields: x y z rgb
[ INFO] [1412698430.495632948]: Data saved to 1412698430415787.pcd
[ INFO] [1412698430.974854796]: Received 307200 data points in frame /camera_rgb_optical_frame with the following fields: x y z rgb
[ INFO] [1412698430.974940083]: Data saved to 1412698430882933.pcd
 
(Ref: http://answers.ros.org/question/47345/kinect-point-cloud-to-pcd-files/ )
This will keep dumping the pointcloud files until you stop the process (ctrl + c).


No comments:

Post a Comment