SAC Segmentation Hangs
I'm using SAC segmentation to find planes in my point cloud data. I find clusters, and then fit a plane to each cluster.
Sometimes I'll get a cluster that causes the node to hang. CPU usage will spike to 100%, and I can't end the node with ctrl-c.
I'm trying to figure out what type of point clouds cause these hangups so I can avoid fitting a plane to them. I thought setting max iterations would avoid this, but it does not. I have tried different methods other than SAC_RANSAC and they do not change the behavior.
Here are the parameters I am using for the segmentation object:
pcl::SACSegmentation<PointT> seg;
Eigen3::Vector3f x_axis = Eigen3::Vector3f(1.0, 0.0, 0.0);
seg.setAxis(x_axis);
seg.setEpsAngle(0.17454);
seg.setOptimizeCoefficients(false);
seg.setModelType (pcl::SACMODEL_PERPENDICULAR_PLANE);
seg.setMethodType (pcl::SAC_RANSAC);
seg.setMaxIterations (100);
seg.setDistanceThreshold (0.05);
Also, following is an example PCD that, when fitted with the above segmentation object, causes the node to hang. I would have attached a file but my karma is not high enough apparently. This cloud is not representative of all clouds that cause the node to hang; they come in all shapes and sizes, and I can't find a certain common characteristic. However, this cloud will reliably cause the segmentation node to hang.
Please let me know if you have any thoughts.
# .PCD v.6 - Point Cloud Data file format
FIELDS x y z intensity
SIZE 4 4 4 4
TYPE F F F F
COUNT 1 1 1 1
WIDTH 51
HEIGHT 1
POINTS 51
DATA ascii
16.884 2.1395 -0.15434 0.12742
16.903 2.1289 -0.15614 0.13139
16.924 2.107 -0.15706 0.13839
16.925 2.0794 -0.15504 0.14496
16.945 2.057 -0.15586 0.15012
16.972 2.052 -0.15916 0.15038
17.003 2.0378 -0.1621 0.15885
17.027 2.0286 -0.16456 0.16036
17.046 2.0045 -0.16518 0.16036
17.054 1.9827 -0.16455 0.1636
17.06 1.9485 -0.16256 0.16843
17.073 1.93 -0.16275 0.16602
17.088 1.9029 -0.1626 0.17087
17.077 1.8675 -0.15815 0.16877
17.113 1.855 -0.16197 0.16877
17.101 1.8207 -0.15765 0.1671
17.123 1.7984 -0.15878 0.1671
17.135 1.7796 -0.15886 0.16715
17.161 1.7594 -0.16068 0.16805
17.177 1.7432 -0.16159 0.16805
17.193 1.7165 -0.16152 0.16805
17.21 1.7006 -0.16255 0.17025
17.209 1.6647 -0.15947 0.17736
17.22 1.6452 -0.1593 0.17025
17.234 1.618 -0.159 0.17271
17.247 1.5996 -0.15923 0.17271
17.28 1.5819 -0.16235 0.17271
17.286 1.5601 -0.16141 0.17034
17.303 1.5338 -0 ...