Skip to content

Commit

Permalink
Fix semgentation fault on too few detections
Browse files Browse the repository at this point in the history
Downstream of the circle detection, refinement and optimization
assumed that 4 circles are successfully extracted from the pointcloud.
We fix this by ensuring that there are exactly 4 detections and
returning early if that condition is not met.
  • Loading branch information
DevonMorris committed Feb 27, 2023
1 parent 232f5c4 commit 1e838a6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lidar_detector/src/lib/keypoint_detection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,12 @@ pcl::PointCloud<pcl::PointXYZ> keypointDetection(pcl::PointCloud<Lidar::PointWit
pcl::PointCloud<pcl::PointXYZ> pattern = processCircles(circles_cloud, cloud_without_ground_floor, config.circle_detection);
if (config.visualize) { visualize(cloud_calibration_board, pattern, edges_cloud); }

if (pattern.size() < 4) {
std::cerr << "Failed to find all circles, found only " << pattern.size() << std::endl;
pattern.clear();
return pattern;
}

// Refine circle centers using calibration board geometry
if (config.refinement.refine) {
// Refinement using kabsch
Expand Down

0 comments on commit 1e838a6

Please sign in to comment.