20 #include <gtest/gtest.h> 34 pcl::PointXYZRGB p_rgb;
35 for (
float i=pos; i<pos+dim; i+=step) {
36 for (
float j=pos; j<pos+dim; j+=step){
37 for (
float k=pos; k<pos+dim; k+=step){
44 cloud->push_back(p_rgb);
54 PointCloudRGB::Ptr cloudRGB {
new pcl::PointCloud<pcl::PointXYZRGB>};
60 int min_fod_points = 3;
61 double voxelize_factor = 3;
62 double th = 4e-3 * voxelize_factor;
64 FODDetector fod_detector(cloudRGB, th*10, min_fod_points);
67 std::vector<PointCloudRGB::Ptr> fods_cloud_array;
70 ASSERT_EQ(num_of_fods,3);
71 ASSERT_EQ(fods_cloud_array.size(),3);
77 pcl::PointCloud<pcl::PointXYZRGB>::Ptr empty_cloud {
new pcl::PointCloud<pcl::PointXYZRGB>};
79 int min_fod_points = 3;
80 double voxelize_factor = 3;
81 double th = 4e-3 * voxelize_factor;
83 FODDetector fod_detector(empty_cloud, th*10, min_fod_points);
86 std::vector<PointCloudRGB::Ptr> fods_cloud_array;
89 ASSERT_EQ(num_of_fods, 0);
90 ASSERT_EQ(fods_cloud_array.size(), 0);
98 pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloudRGB {
new pcl::PointCloud<pcl::PointXYZRGB>};
104 int min_fod_points = 3;
105 double voxelize_factor = 3;
106 double th = 4e-3 * voxelize_factor;
108 FODDetector fod_detector(cloudRGB, th*10, min_fod_points);
111 std::vector<sensor_msgs::PointCloud2> cluster_msg_array;
114 ASSERT_EQ(num_of_fods, 3);
115 ASSERT_EQ(cluster_msg_array.size(), 3);
119 int main(
int argc,
char **argv){
120 testing::InitGoogleTest(&argc, argv);
122 return RUN_ALL_TESTS();
int fodIndicesToPointCloud(std::vector< PointCloudRGB::Ptr > &cloud_array)
Save each cluster (possible FOD) in a pcl::PointCloudRGB. Give back an array of all generated clouds...
int main(int argc, char **argv)
TEST_F(TestFODDetector, testFODClustering)
void clusterPossibleFODs()
Extract cluster indices from input cloud with resolution set. Each cluster is a possible FOD...
int fodIndicesToROSMsg(std::vector< sensor_msgs::PointCloud2 > &cluster_msg_array)
Save each cluster (possible FOD) in a PointCloud2 msg. Give back an array of all generated msgs...
pcl::PointCloud< pcl::PointXYZRGB > PointCloudRGB
void cubesPointCloud(PointCloudRGB::Ptr cloud, float pos, float dim, float step)