Unable to read a .pcd file

asked 2016-04-05 15:00:17 -0600

Hello I am using pcl to read a .pcd file in ros. I can read less dense files, however when it comes to more dense files, with more fields, that is x,y,z, normal x, normal y, normal z it doesnot view the point cloud anymore. My code is as follows which is a very simple snippet. I am facing the problem when I am trying to see around a million point dense cloud.

#include <ros/ros.h>
#include <pcl/point_cloud.h>
#include <pcl_conversions/pcl_conversions.h>
#include <sensor_msgs/PointCloud2.h>
#include <pcl/io/pcd_io.h>

main(int argc, char **argv){
ros::init (argc, argv, "pcl_read");

ros::NodeHandle nh;
ros::Publisher pcl_pub = nh.advertise<sensor_msgs::PointCloud2> ("pcl_output", 1);

sensor_msgs::PointCloud2 output;
pcl::PointCloud<pcl::PointXYZ> cloud;

pcl::io::loadPCDFile ("milk.pcd", cloud);

pcl::toROSMsg(cloud, output);
output.header.frame_id = "odom";

ros::Rate loop_rate(1);
while (ros::ok())

    return 0;
edit retag flag offensive close merge delete