PointCloud2 parse to xyz array in ROS2
I'm trying to find a solution of converting PointCloud2 message data into xyz array for further analysis. Though, in my case I'm interested only in 2d application.
The information is either scarce or confusing.
Each point data in the PointCloud2 is stored as a binary blob. For example: First 1-4 numbers represent x as a 32 bit float, 5-8 represents y, 9-12 represents z, 13-16 represents the intensity.
So, my question is, is there any ROS2 library to make the conversion? Alternatively, any example of implementing it in C++.
For both cases, please provide a full code snippet or a link to an example.