Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 171

PointCloud2 access data

$
0
0
I have a PointCloud2 topic and I need to access the x, y and z of the points. I have found: pcl::PointCloud::ConstPtr The problem is that I don't know how to use it. Do you know where can I find some example code describing how to get coordinates in PCL2? [EDIT] Now, I am using this code but it is not working properly void pcl2_to_scan::callback(const sensor_msgs::PointCloud2ConstPtr &pPCL2) { for (uint j=0; j < pPCL2->height * pPCL2->width; j++){ float x = pPCL2->data[j * pPCL2->point_step + pPCL2->fields[0].offset]; float y = pPCL2->data[j * pPCL2->point_step + pPCL2->fields[1].offset]; float z = pPCL2->data[j * pPCL2->point_step + pPCL2->fields[2].offset]; // Some other operations } } Thank you.

Viewing all articles
Browse latest Browse all 171

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>