I want to set a point cloud as a member of a class, and declare PointCloud::Ptr out_pcl_cloud; in the class definition. However, when I try to concatenate several point clouds together, it always gives me segmentation fault.
To solve this, declare a new pointer in the cpp file, PointCloud::Ptr cur_pcl_cloud (new PointCloud());, and use out_pcl_cloud = cur_pcl_cloud; to copy the point cloud data. Do not use *out_pcl_cloud = *cur_pcl_cloud; which appears to copy nothing.
To show all the pcl continuously, initialize the viewer by pcl::visualization::CloudViewer viewer( "viewer" );, and then viewer.showCloud( vo.out_pcl_cloud ); Do not use while( !viewer.wasStopped() ).
No comments:
Post a Comment