0
votes

I have a rostopic that receives a single frame (2D) point cloud (with x,y coordinates) per message and I need to create a (3D) point cloud concatenating the latest 100 frames (over z axis). The purpose is to always show a point cloud made out of the latest 100 frames like a FIFO queue.

I can concatenate the frames using cloud->points.push_back (pcl::PointXYZ(pt.x, pt.y, z)); method over the z axis.

The tricky part is after reaching up to 100 frames how to remove the oldest frame? (Ex: Remove points with z index 1) I was trying to use the method points.erase (iterator first, iterator last) but, I don't know how to pass the iterator parameter. Even, if I could achieve that; how can I shift the existing point cloud to start from z=1? Appreciate any help on this.

1

1 Answers

1
votes

Since cloud->points is an std::vector, see std::vector::erase for an example on how to pass the iterator parameter.