Extract a Volume of points from a PointCloud2 message
Hi all, I'm trying to achieve something simple, yet I can't seem to find a way to do this. I have a PointCloud2 (as a .pcd file) and a bounding box defined in the same frame as the PointCloud2. I want to extract all the points that lie inside that bounding box and save them as a new .pcd file with the centroid of the box set as the origin of that point cloud.
A sample bounding box looks like this:
"bbox": {
"position": {
"position": {
"y": -24.204870224,
"x": 23.0722198486,
"z": -2.88637971878
},
"orientation": {
"y": -0.0256392564625,
"x": 0.01510348171,
"z": 0.704603254795,
"w": 0.708977282047
}
},
"size": {
"y": 1.84718394279,
"x": 3.94384384155,
"z": 1.66313385963
}
}
So I have the position (which I want to be the origin of the new PointCloud), the size of the box, and also the orientation as a quaternion.
How can I do this? Any pointers to PCL tutorials would be helpful as well. Thank you!