bag_reader.cpp
Go to the documentation of this file.
00001 #include "pcl_ros/io/bag_io.h"
00002 #include "pcl/point_types.h"
00003 #include "pcl/io/pcd_io.h"
00004 
00005 int main (int argc, char** argv)
00006 {
00007   sensor_msgs::PointCloud2ConstPtr cloud_blob, cloud_blob_prev;
00008   pcl::PointCloud<pcl::PointXYZ> cloud;
00009   for(int i=0; i < argc; i++)
00010   {
00011       printf("%s", argv[i]);
00012   }
00013 
00014   pcl_ros::BAGReader reader;
00015   if (!reader.open ("./table_top2.bag", "/table_cloud"))
00016   {
00017     ROS_ERROR ("Couldn't read file test_io_bag.bag. Try doing a 'make tests' in pcl, or download the file manually from http://pr.willowgarage.com/data/pcl/test_io_bag.bag");
00018     return (-1);
00019   }
00020 
00021   int cnt = 0;
00022   do
00023   {
00024     cloud_blob_prev = cloud_blob;
00025     cloud_blob = reader.getNextCloud ();
00026     if (cloud_blob_prev != cloud_blob)
00027     {
00028       pcl::fromROSMsg (*cloud_blob, cloud);
00029       ROS_INFO ("PointCloud with %d data points and frame %s (%f) received.", (int)cloud.points.size (), cloud.header.frame_id.c_str (), cloud.header.stamp.toSec ()); 
00030       pcl::io::savePCDFileASCII ("table_cloud.pcd", cloud);
00031       //if (cnt == 0)
00032       //{
00033       //    for(int i=0; i < cloud.points.size();i++)
00034       //    {
00035       //    }
00036       //}
00037       cnt++;
00038     }
00039   }
00040   while (cloud_blob != cloud_blob_prev);
00041 
00042   ROS_INFO ("Total number of PointCloud messages processed: %d", cnt);
00043 
00044   return (0);
00045 }
00046 


feature_extractor_fpfh
Author(s): Hai Nguyen
autogenerated on Wed Nov 27 2013 11:46:12