Go to the documentation of this file.00001
00012 #ifndef RAIL_PICK_AND_PLACE_POINT_CLOUD_METRICS_H_
00013 #define RAIL_PICK_AND_PLACE_POINT_CLOUD_METRICS_H_
00014
00015
00016 #include <geometry_msgs/Point.h>
00017 #include <graspdb/Grasp.h>
00018 #include <sensor_msgs/PointCloud2.h>
00019 #include <tf2/LinearMath/Transform.h>
00020
00021
00022 #include <pcl/point_cloud.h>
00023 #include <pcl/point_types.h>
00024
00025
00026 #include <vector>
00027
00028 namespace rail
00029 {
00030 namespace pick_and_place
00031 {
00032 namespace point_cloud_metrics
00033 {
00034
00036 static const double DEFAULT_FILTER_OUTLIER_SEARCH_RADIUS = 0.01;
00038 static const double DEFAULT_FILTER_REDUNDANT_SEARCH_RADIUS = 0.0004;
00040 static const int DEFAULT_FILTER_OUTLIER_MIN_NUM_NEIGHBORS = 6;
00042 static const double DEFAULT_METRIC_OVERLAP_SEARCH_RADIUS = 0.005;
00043
00052 void rosPointCloud2ToPCLPointCloud(const sensor_msgs::PointCloud2 in,
00053 const pcl::PointCloud<pcl::PointXYZRGB>::Ptr &out);
00054
00063 void pclPointCloudToROSPointCloud2(const pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr &in,
00064 sensor_msgs::PointCloud2 &out);
00065
00076 void filterPointCloudOutliers(const pcl::PointCloud<pcl::PointXYZRGB>::Ptr &pc,
00077 const double filter_outlier_search_radius = DEFAULT_FILTER_OUTLIER_SEARCH_RADIUS,
00078 const double filter_outlier_min_num_neighbors = DEFAULT_FILTER_OUTLIER_MIN_NUM_NEIGHBORS);
00079
00088 void filterRedundantPoints(const pcl::PointCloud<pcl::PointXYZRGB>::Ptr &pc,
00089 const double filter_redundant_search_radius = DEFAULT_FILTER_REDUNDANT_SEARCH_RADIUS);
00090
00099 geometry_msgs::Point computeCentroid(const pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr &pc);
00100
00109 void transformToOrigin(const pcl::PointCloud<pcl::PointXYZRGB>::Ptr &pc, const geometry_msgs::Point ¢roid);
00110
00118 void transformToOrigin(const pcl::PointCloud<pcl::PointXYZRGB>::Ptr &pc);
00119
00129 void transformToOrigin(const pcl::PointCloud<pcl::PointXYZRGB>::Ptr &pc,
00130 std::vector<graspdb::Grasp> &grasps, const geometry_msgs::Point ¢roid);
00131
00140 void transformToOrigin(const pcl::PointCloud<pcl::PointXYZRGB>::Ptr &pc,
00141 std::vector<graspdb::Grasp> &grasps);
00142
00152 double calculateRegistrationMetricDistanceError(const pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr &base,
00153 const pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr &target);
00154
00168 void calculateRegistrationMetricOverlap(const pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr &base,
00169 const pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr &target, double &overlap, double &color_error,
00170 const double metric_overlap_search_radius = DEFAULT_METRIC_OVERLAP_SEARCH_RADIUS);
00171
00182 void calculateAvgColors(const pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr &pc, double &avg_r, double &avg_g,
00183 double &avg_b);
00184
00195 double calculateStdDevColors(const pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr &pc, double &std_dev_r,
00196 double &std_dev_g, double &std_dev_b);
00197
00211 double calculateStdDevColors(const pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr &pc, double &std_dev_r,
00212 double &std_dev_g, double &std_dev_b, const double avg_r, const double avg_g, const double avg_b);
00213
00224 bool classifyMerge(const pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr &base,
00225 const pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr &target);
00226
00237 tf2::Transform performICP(const pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr &target,
00238 const pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr &source, const pcl::PointCloud<pcl::PointXYZRGB>::Ptr &result);
00239 }
00240 }
00241 }
00242
00243 #endif