File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 2020#include < pcl/filters/voxel_grid.h>
2121#include < pcl/search/kdtree.h>
2222#include < pcl/segmentation/extract_clusters.h>
23+ #include < pcl/common/point_tests.h>
2324// ROS package
2425#include " lidar_cluster/marker.hpp"
2526// Benchmarking
@@ -280,6 +281,15 @@ class EuclideanGrid : public rclcpp::Node
280281 RCLCPP_INFO_STREAM (this ->get_logger (), " PointCloud in: " << original_size << " reduced size before cluster: " << cloud->width * cloud->height );
281282 }
282283
284+ // if any point in the pointcloud is not a proper number, modify that value to zero
285+ for (auto &point : cloud_xyz->points ) {
286+ if (!pcl::isFinite (point)) {
287+ point.x = 0.0 ;
288+ point.y = 0.0 ;
289+ point.z = 0.0 ;
290+ }
291+ }
292+
283293 // Create voxel grid and project to 2D
284294 pcl::PointCloud<pcl::PointXYZ>::Ptr voxel_map_ptr (new pcl::PointCloud<pcl::PointXYZ>);
285295 pcl::VoxelGrid<pcl::PointXYZ> voxel_grid;
You can’t perform that action at this time.
0 commit comments