0
$\begingroup$

Rosanswers logo

Hello

I'm using the SampleConsensusModelLine, which requires a pointcloud on the form of pcl::PointCloudpcl::PointXYZ::Ptr. However, the callback for the point cloud uses the form sensor_msgs::PointCloud2ConstPtr. How do I convert one to the other?


Originally posted by erwhelewoli on ROS Answers with karma: 51 on 2016-05-11

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

To convert PCLPointCloud2::Ptr to PointCloudpcl::PointXYZ , you have to use the function "fromPCLPointCloud2".

For example :

pcl::PCLPointCloud2::Ptr cloud_filtered (new pcl::PCLPointCloud2 ());
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_filtered1 (new pcl::PointCloud<pcl::PointXYZ>()); 
    
pcl::fromPCLPointCloud2(*(cloud_filtered), *(cloud_filtered1));

Originally posted by Jbot with karma: 429 on 2016-05-11

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.