hector_stair_detection.h
Go to the documentation of this file.
00001 #ifndef Hector_Stair_Detection_H
00002 #define Hector_Stair_Detection_H
00003 
00004 #include <ros/ros.h>
00005 
00006 #include <tf/tf.h>
00007 #include <pcl/kdtree/kdtree.h>
00008 #include <pcl/sample_consensus/method_types.h>
00009 #include <pcl/sample_consensus/model_types.h>
00010 #include <pcl/segmentation/extract_clusters.h>
00011 #include <pcl/ModelCoefficients.h>
00012 #include <pcl/io/pcd_io.h>
00013 #include <pcl/point_types.h>
00014 #include <pcl/filters/extract_indices.h>
00015 #include <pcl/filters/passthrough.h>
00016 #include <pcl/features/normal_3d.h>
00017 #include <pcl/sample_consensus/method_types.h>
00018 #include <pcl/sample_consensus/model_types.h>
00019 #include <pcl/segmentation/sac_segmentation.h>
00020 #include <pcl/point_representation.h>
00021 #include <pcl/point_cloud.h>
00022 #include <pcl/kdtree/kdtree_flann.h>
00023 #include <std_msgs/Header.h>
00024 #include <nav_msgs/MapMetaData.h>
00025 #include <geometry_msgs/Pose.h>
00026 #include <geometry_msgs/Vector3.h>
00027 #include <stdio.h>
00028 #include <string>
00029 #include <math.h>
00030 
00031 #include <sensor_msgs/PointCloud2.h>
00032 #include <pcl_ros/point_cloud.h>
00033 #include <pcl/conversions.h>
00034 #include <pcl_ros/transforms.h>
00035 #include <tf/transform_datatypes.h>
00036 #include <tf/transform_listener.h>
00037 #include <tf_conversions/tf_eigen.h>
00038 #include <pcl/filters/voxel_grid.h>
00039 #include <visualization_msgs/Marker.h>
00040 #include <visualization_msgs/MarkerArray.h>
00041 #include <pcl/surface/processing.h>
00042 #include <pcl/surface/mls.h>
00043 #include <pcl/filters/statistical_outlier_removal.h>
00044 #include <pcl/octree/octree_pointcloud.h>
00045 #include <pcl/segmentation/conditional_euclidean_clustering.h>
00046 
00047 //#include <vigir_perception_msgs/PointCloudRegionRequest.h>
00048 //#include <vigir_perception_msgs/EnvironmentRegionRequest.h>
00049 
00050 #include <hector_stair_detection/hector_stair_detection.h>
00051 
00052 #include <hector_stair_detection_msgs/BorderAndOrientationOfStairs.h>
00053 #include <hector_stair_detection_msgs/PositionAndOrientaion.h>
00054 
00055 namespace hector_stair_detection{
00056 
00057 class HectorStairDetection{
00058 
00059 public:
00060     HectorStairDetection();
00061     virtual ~HectorStairDetection();
00062     void PclCallback(const sensor_msgs::PointCloud2::ConstPtr& pc_msg);
00063 
00064 protected:
00065     ros::Publisher possible_stairs_cloud_pub_;
00066     ros::Publisher points_on_line_cloud_debug_;
00067     ros::Publisher surfaceCloud_pub_debug_;
00068     ros::Publisher final_stairs_cloud_pub_;
00069     ros::Publisher border_of_stairs_pub_;
00070     ros::Publisher stairs_position_and_orientaion_pub_;
00071     ros::Publisher border_and_orientation_stairs_combined_pub_;
00072     ros::Publisher stairs_position_and_orientaion_with_direction_pub_;
00073     ros::Publisher cloud_after_plane_detection_debug_pub_;
00074     ros::Publisher line_marker_pub_;
00075 
00076     ros::Publisher temp_orginal_pub_;
00077     ros::Publisher temp_after_pass_trough_pub_;
00078     ros::Publisher temp_after_voxel_grid_pub_;
00079     ros::Publisher temp_after_mls_pub_;
00080 
00081     ros::Subscriber pcl_sub;
00082     tf::TransformListener listener_;
00083     Eigen::Affine3d to_map_;
00084 
00085 private:
00086     //params
00087     double passThroughZMin_;
00088     double passThroughZMax_;
00089     double voxelGridX_;
00090     double voxelGridY_;
00091     double voxelGridZ_;
00092     int minRequiredPointsOnLine_;
00093     double distanceToLineTresh_;
00094     bool refineSurfaceRequired_; //in hector setup true
00095     std::string worldFrame_;
00096     double clusterHeightTresh_;
00097     double maxClusterXYDimension_;
00098     double clusterTolerance_;
00099     int clusterMinSize_;
00100     int clusterMaxSize_;
00101     std::string setup_;
00102     double distTrashSegmentation_;
00103     double maxDistBetweenStairsPoints_;
00104     double minHightDistBetweenAllStairsPoints_;
00105     double planeSegDistTresh_;
00106     double planeSegAngleEps_;
00107     double hesseTresh_;
00108 
00109     void getPreprocessedCloud(pcl::PointCloud<pcl::PointXYZ>::Ptr &input_cloud, pcl::PointCloud<pcl::PointNormal>::Ptr &output_cloud);
00110     void refineOrientaion(Eigen::Vector2f directionStairs, Eigen::Vector2f minXminY, Eigen::Vector2f maxXminY, Eigen::Vector2f minXmaxY, geometry_msgs::PoseStamped &position_and_orientaion);
00111     void getFinalStairsCloud_and_position(std::string frameID, Eigen::Vector3f directionS, pcl::PointCloud<pcl::PointNormal>::Ptr &input_surface_cloud, pcl::PointCloud<pcl::PointXYZ>::Ptr &planeCloud, pcl::IndicesClustersPtr cluster_indices, std::vector<int> final_cluster_idx,
00112                                                                 pcl::PointCloud<pcl::PointXYZ>::Ptr &final_stairsCloud, visualization_msgs::MarkerArray &stairs_boarder_marker, Eigen::Vector3f base);
00113     void getStairsPositionAndOrientation(Eigen::Vector3f& base, Eigen::Vector3f point, std::string frameID, Eigen::Vector3f &direction, geometry_msgs::PoseStamped &position_and_orientaion);
00114     void publishResults(pcl::PointCloud<pcl::PointNormal>::Ptr &input_surface_cloud, pcl::PointCloud<pcl::PointXYZ>::Ptr &planeCloud,
00115                                               pcl::IndicesClustersPtr cluster_indices, std::vector<int> final_cluster_idx, Eigen::Vector3f base, Eigen::Vector3f point);
00116     int getZComponent(Eigen::Vector2f directionStairs, Eigen::Vector2f minXminY, Eigen::Vector2f maxXminY, Eigen::Vector2f minXmaxY);
00117     float maxDistBetweenPoints(pcl::PointCloud<pcl::PointXYZI>::Ptr input_cloud);
00118     bool pointInCloud(pcl::PointCloud<pcl::PointXYZI>::Ptr cloud, pcl::PointXYZ point);
00119     float minHightDistBetweenPoints(pcl::PointCloud<pcl::PointXYZI>::Ptr input_cloud);
00120     void stairsSreachPlaneDetection(pcl::PointCloud<pcl::PointNormal>::Ptr &input_surface_cloud, pcl::PointCloud<pcl::PointXYZI>::Ptr points_on_line, Eigen::Vector3f base, Eigen::Vector3f dir, pcl::PointCloud<pcl::PointXYZ>::Ptr &planeCloud);
00121     bool checkExtentionDirection(Eigen::Vector2f directionStairs, Eigen::Vector2f directionExtend);
00122     void projectStairsToFloor(Eigen::Vector3f direction, visualization_msgs::MarkerArray &stairs_boarder_marker);
00123 };
00124 }
00125 
00126 #endif


hector_stair_detection
Author(s):
autogenerated on Mon Aug 15 2016 03:58:13