pcd_read.cpp
Go to the documentation of this file.
00001 /*
00002    Copied from pcl tutorial.
00003 
00004 */
00005 
00006 #include "pcl/io/pcd_io.h"
00007 #include "pcl/point_types.h"
00008 
00009 int main (int argc, char** argv)
00010 {
00011   sensor_msgs::PointCloud2 cloud_blob;
00012   pcl::PointCloud<pcl::PointXYZ> cloud;
00013 
00014   if (pcl::io::loadPCDFile ("test_pcd.pcd", cloud_blob) == -1)
00015   {
00016     ROS_ERROR ("Couldn't read file test_pcd.pcd");
00017     return (-1);
00018   }
00019   ROS_INFO ("Loaded %d data points from test_pcd.pcd with the following fields: %s", (int)(cloud_blob.width * cloud_blob.height), pcl::getFieldsList (cloud_blob).c_str ());
00020 
00021   // Convert to the templated message type
00022   point_cloud::fromMsg (cloud_blob, cloud);
00023 
00024   std::cout << "Size of point cloud:" << cloud.points.size() << std::endl;
00025 //  for (size_t i = 0; i < cloud.points.size (); ++i)
00026 //    std::cerr << "    " << cloud.points[i].x << " " << cloud.points[i].y << " " << cloud.points[i].z << std::endl;
00027 
00028   return (0);
00029 }
00030 


point_cloud_ros
Author(s): Advait Jain (Healthcare Robotics Lab, Georgia Tech)
autogenerated on Wed Nov 27 2013 12:16:42