hector_stair_detection.h
Go to the documentation of this file.
1 #ifndef Hector_Stair_Detection_H
2 #define Hector_Stair_Detection_H
3 
4 #include <ros/ros.h>
5 
6 #include <tf/tf.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>
27 #include <stdio.h>
28 #include <string>
29 #include <math.h>
30 
31 #include <sensor_msgs/PointCloud2.h>
32 #include <pcl_ros/point_cloud.h>
33 #include <pcl/conversions.h>
34 #include <pcl_ros/transforms.h>
35 #include <tf/transform_datatypes.h>
36 #include <tf/transform_listener.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>
46 
47 //#include <vigir_perception_msgs/PointCloudRegionRequest.h>
48 //#include <vigir_perception_msgs/EnvironmentRegionRequest.h>
49 
51 
52 #include <hector_stair_detection_msgs/BorderAndOrientationOfStairs.h>
53 #include <hector_stair_detection_msgs/PositionAndOrientaion.h>
54 
56 
58 
59 public:
61  virtual ~HectorStairDetection();
62  void PclCallback(const sensor_msgs::PointCloud2::ConstPtr& pc_msg);
63 
64 protected:
75 
80 
83  Eigen::Affine3d to_map_;
84 
85 private:
86  //params
89  double voxelGridX_;
90  double voxelGridY_;
91  double voxelGridZ_;
94  bool refineSurfaceRequired_; //in hector setup true
95  std::string worldFrame_;
101  std::string setup_;
107  double hesseTresh_;
108 
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);
117  float maxDistBetweenPoints(pcl::PointCloud<pcl::PointXYZI>::Ptr input_cloud);
118  bool pointInCloud(pcl::PointCloud<pcl::PointXYZI>::Ptr cloud, pcl::PointXYZ point);
119  float minHightDistBetweenPoints(pcl::PointCloud<pcl::PointXYZI>::Ptr input_cloud);
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);
121  bool checkExtentionDirection(Eigen::Vector2f directionStairs, Eigen::Vector2f directionExtend);
122  void projectStairsToFloor(Eigen::Vector3f direction, visualization_msgs::MarkerArray &stairs_boarder_marker);
123 };
124 }
125 
126 #endif
void getStairsPositionAndOrientation(Eigen::Vector3f &base, Eigen::Vector3f point, std::string frameID, Eigen::Vector3f &direction, geometry_msgs::PoseStamped &position_and_orientaion)
void projectStairsToFloor(Eigen::Vector3f direction, visualization_msgs::MarkerArray &stairs_boarder_marker)
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)
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)
bool pointInCloud(pcl::PointCloud< pcl::PointXYZI >::Ptr cloud, pcl::PointXYZ point)
float maxDistBetweenPoints(pcl::PointCloud< pcl::PointXYZI >::Ptr input_cloud)
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)
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)
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)


hector_stair_detection
Author(s):
autogenerated on Mon Jun 10 2019 13:36:41