Created
April 30, 2018 06:07
-
-
Save Kyungpyo-Kim/b0cd1528913cb36bab6779a384dd2021 to your computer and use it in GitHub Desktop.
PCL, ROS, sensor_msgs::PointCloud2 to PCL type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <pcl_conversions/pcl_conversions.h> | |
#include <pcl/point_types.h> | |
#include <pcl/PCLPointCloud2.h> | |
#include <pcl/conversions.h> | |
#include <pcl_ros/transforms.h> | |
void cloud_cb(const boost::shared_ptr<const sensor_msgs::PointCloud2>& input){ | |
pcl::PCLPointCloud2 pcl_pc2; | |
pcl_conversions::toPCL(*input,pcl_pc2); | |
pcl::PointCloud<pcl::PointXYZ>::Ptr temp_cloud(new pcl::PointCloud<pcl::PointXYZ>); | |
pcl::fromPCLPointCloud2(pcl_pc2,*temp_cloud); | |
//do stuff with temp_cloud here | |
} | |
// Reference | |
/* | |
/* https://answers.ros.org/question/136916/conversion-from-sensor_msgspointcloud2-to-pclpointcloudt/ | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey, thanks a lot for the repo, but I need pointcloud stitching to be specfic and not just merge. My code works as expected only issue being the point cloud becomes unordered in the end leading to difficulties in using various pcl algorithms, trying to find workarounds for that.