@@ -329,6 +329,11 @@ bool service_callback(object_detection::ObjectDetection::Request &req,
329329 pass_z2.filter (*cloud_filtered_ptr_z2);
330330 if (DEBUG) cerr << " PointCloud after filtering: " << cloud_filtered_ptr_z2->width << " " << cloud_filtered_ptr->height << " data points." << endl;
331331
332+ // Convert to ROS data type
333+ sensor_msgs::PointCloud2 output;
334+ pcl_conversions::fromPCL (*cloud_filtered_ptr_z2, output);
335+ pcl_pub.publish (output);
336+
332337 // Create the KdTree object for the search method of the extraction
333338 pcl::search::KdTree<pcl::PointXYZ>::Ptr tree (new pcl::search::KdTree<pcl::PointXYZ>);
334339 pcl::PointCloud<pcl::PointXYZ>::Ptr pcl_cloud_cleaned (new pcl::PointCloud<pcl::PointXYZ>);
@@ -341,7 +346,7 @@ bool service_callback(object_detection::ObjectDetection::Request &req,
341346 pcl::EuclideanClusterExtraction<pcl::PointXYZ> ec;
342347 // specify euclidean cluster parameters
343348 ec.setClusterTolerance (0.02 ); // 2cm
344- ec.setMinClusterSize (100 );
349+ ec.setMinClusterSize (200 );
345350 ec.setMaxClusterSize (25000 );
346351 ec.setSearchMethod (tree);
347352 ec.setInputCloud (pcl_cloud_cleaned);
@@ -374,9 +379,9 @@ bool service_callback(object_detection::ObjectDetection::Request &req,
374379 // pcl::io::savePCDFile("/home/heethesh/ROS-Workspaces/dash_ws/src/perception/object_detection/templates/clamp.pcd", *object_cluster_pcl, true);
375380
376381 // Convert to ROS data type
377- sensor_msgs::PointCloud2 output;
378- pcl_conversions::fromPCL (*object_cluster, output);
379- pcl_pub.publish (output);
382+ // sensor_msgs::PointCloud2 output;
383+ // pcl_conversions::fromPCL(*object_cluster, output);
384+ // pcl_pub.publish(output);
380385
381386 // Read template point cloud
382387 string template_filename = template_path + template_filenames[req.object_id ];
0 commit comments