1 #ifndef Hector_Stair_Detection_H 2 #define Hector_Stair_Detection_H 7 #include <pcl/kdtree/kdtree.h> 8 #include <pcl/sample_consensus/method_types.h> 9 #include <pcl/sample_consensus/model_types.h> 10 #include <pcl/segmentation/extract_clusters.h> 11 #include <pcl/ModelCoefficients.h> 12 #include <pcl/io/pcd_io.h> 13 #include <pcl/point_types.h> 14 #include <pcl/filters/extract_indices.h> 15 #include <pcl/filters/passthrough.h> 16 #include <pcl/features/normal_3d.h> 17 #include <pcl/sample_consensus/method_types.h> 18 #include <pcl/sample_consensus/model_types.h> 19 #include <pcl/segmentation/sac_segmentation.h> 20 #include <pcl/point_representation.h> 21 #include <pcl/point_cloud.h> 22 #include <pcl/kdtree/kdtree_flann.h> 23 #include <std_msgs/Header.h> 24 #include <nav_msgs/MapMetaData.h> 25 #include <geometry_msgs/Pose.h> 26 #include <geometry_msgs/Vector3.h> 31 #include <sensor_msgs/PointCloud2.h> 32 #include <pcl_ros/point_cloud.h> 33 #include <pcl/conversions.h> 34 #include <pcl_ros/transforms.h> 38 #include <pcl/filters/voxel_grid.h> 39 #include <visualization_msgs/Marker.h> 40 #include <visualization_msgs/MarkerArray.h> 41 #include <pcl/surface/processing.h> 42 #include <pcl/surface/mls.h> 43 #include <pcl/filters/statistical_outlier_removal.h> 44 #include <pcl/octree/octree_pointcloud.h> 45 #include <pcl/segmentation/conditional_euclidean_clustering.h> 52 #include <hector_stair_detection_msgs/BorderAndOrientationOfStairs.h> 53 #include <hector_stair_detection_msgs/PositionAndOrientaion.h> 62 void PclCallback(
const sensor_msgs::PointCloud2::ConstPtr& pc_msg);
109 void getPreprocessedCloud(pcl::PointCloud<pcl::PointXYZ>::Ptr &input_cloud, pcl::PointCloud<pcl::PointNormal>::Ptr &output_cloud);
110 void refineOrientaion(Eigen::Vector2f directionStairs, Eigen::Vector2f minXminY, Eigen::Vector2f maxXminY, Eigen::Vector2f minXmaxY, geometry_msgs::PoseStamped &position_and_orientaion);
111 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,
112 pcl::PointCloud<pcl::PointXYZ>::Ptr &final_stairsCloud, visualization_msgs::MarkerArray &stairs_boarder_marker, Eigen::Vector3f base);
113 void getStairsPositionAndOrientation(Eigen::Vector3f& base, Eigen::Vector3f point, std::string frameID, Eigen::Vector3f &direction, geometry_msgs::PoseStamped &position_and_orientaion);
114 void publishResults(pcl::PointCloud<pcl::PointNormal>::Ptr &input_surface_cloud, pcl::PointCloud<pcl::PointXYZ>::Ptr &planeCloud,
115 pcl::IndicesClustersPtr cluster_indices, std::vector<int> final_cluster_idx, Eigen::Vector3f base, Eigen::Vector3f point);
116 int getZComponent(Eigen::Vector2f directionStairs, Eigen::Vector2f minXminY, Eigen::Vector2f maxXminY, Eigen::Vector2f minXmaxY);
118 bool pointInCloud(pcl::PointCloud<pcl::PointXYZI>::Ptr cloud, pcl::PointXYZ point);
120 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);
122 void projectStairsToFloor(Eigen::Vector3f direction, visualization_msgs::MarkerArray &stairs_boarder_marker);
void getStairsPositionAndOrientation(Eigen::Vector3f &base, Eigen::Vector3f point, std::string frameID, Eigen::Vector3f &direction, geometry_msgs::PoseStamped &position_and_orientaion)
ros::Publisher line_marker_pub_
ros::Publisher final_stairs_cloud_pub_
double distTrashSegmentation_
virtual ~HectorStairDetection()
ros::Publisher border_of_stairs_pub_
ros::Publisher temp_orginal_pub_
void projectStairsToFloor(Eigen::Vector3f direction, visualization_msgs::MarkerArray &stairs_boarder_marker)
ros::Publisher cloud_after_plane_detection_debug_pub_
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)
tf::TransformListener listener_
double maxClusterXYDimension_
bool refineSurfaceRequired_
int minRequiredPointsOnLine_
void getPreprocessedCloud(pcl::PointCloud< pcl::PointXYZ >::Ptr &input_cloud, pcl::PointCloud< pcl::PointNormal >::Ptr &output_cloud)
void refineOrientaion(Eigen::Vector2f directionStairs, Eigen::Vector2f minXminY, Eigen::Vector2f maxXminY, Eigen::Vector2f minXmaxY, geometry_msgs::PoseStamped &position_and_orientaion)
ros::Publisher stairs_position_and_orientaion_with_direction_pub_
ros::Publisher possible_stairs_cloud_pub_
double planeSegDistTresh_
ros::Publisher surfaceCloud_pub_debug_
bool pointInCloud(pcl::PointCloud< pcl::PointXYZI >::Ptr cloud, pcl::PointXYZ point)
float maxDistBetweenPoints(pcl::PointCloud< pcl::PointXYZI >::Ptr input_cloud)
double maxDistBetweenStairsPoints_
ros::Publisher points_on_line_cloud_debug_
double clusterHeightTresh_
bool checkExtentionDirection(Eigen::Vector2f directionStairs, Eigen::Vector2f directionExtend)
int getZComponent(Eigen::Vector2f directionStairs, Eigen::Vector2f minXminY, Eigen::Vector2f maxXminY, Eigen::Vector2f minXmaxY)
void PclCallback(const sensor_msgs::PointCloud2::ConstPtr &pc_msg)
float minHightDistBetweenPoints(pcl::PointCloud< pcl::PointXYZI >::Ptr input_cloud)
ros::Publisher temp_after_pass_trough_pub_
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, pcl::PointCloud< pcl::PointXYZ >::Ptr &final_stairsCloud, visualization_msgs::MarkerArray &stairs_boarder_marker, Eigen::Vector3f base)
ros::Publisher stairs_position_and_orientaion_pub_
ros::Publisher border_and_orientation_stairs_combined_pub_
ros::Publisher temp_after_voxel_grid_pub_
ros::Publisher temp_after_mls_pub_
void publishResults(pcl::PointCloud< pcl::PointNormal >::Ptr &input_surface_cloud, pcl::PointCloud< pcl::PointXYZ >::Ptr &planeCloud, pcl::IndicesClustersPtr cluster_indices, std::vector< int > final_cluster_idx, Eigen::Vector3f base, Eigen::Vector3f point)
double minHightDistBetweenAllStairsPoints_
double distanceToLineTresh_