organized_multi_plane_segmentation.h
Go to the documentation of this file.
1 // -*- mode: C++ -*-
2 /*********************************************************************
3  * Software License Agreement (BSD License)
4  *
5  * Copyright (c) 2013, Ryohei Ueda and JSK Lab
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/o2r other materials provided
17  * with the distribution.
18  * * Neither the name of the JSK Lab nor the names of its
19  * contributors may be used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  *********************************************************************/
35 
36 #ifndef JSK_PCL_ROS_ORGANIZED_PLANE_SEGMENTATION_H_
37 #define JSK_PCL_ROS_ORGANIZED_PLANE_SEGMENTATION_H_
38 
39 #include <ros/ros.h>
40 #include <ros/names.h>
41 
42 #include "jsk_recognition_msgs/ClusterPointIndices.h"
43 #include "sensor_msgs/PointCloud2.h"
44 #include <pcl_ros/pcl_nodelet.h>
45 #include <pcl/segmentation/organized_multi_plane_segmentation.h>
46 #include <dynamic_reconfigure/server.h>
47 #include "jsk_pcl_ros/OrganizedMultiPlaneSegmentationConfig.h"
48 #include "jsk_recognition_msgs/PolygonArray.h"
49 #include "jsk_recognition_msgs/ModelCoefficientsArray.h"
54 
59 
60 namespace jsk_pcl_ros
61 {
64  {
65  public:
66  typedef pcl::PointXYZRGBA PointT;
67  typedef std::vector<pcl::PlanarRegion<PointT>,
68  Eigen::aligned_allocator<pcl::PlanarRegion<PointT> > >
70  typedef jsk_pcl_ros::OrganizedMultiPlaneSegmentationConfig Config;
71  protected:
73  // methods
75  virtual void segment(const sensor_msgs::PointCloud2::ConstPtr& msg);
76  virtual void estimateNormal(pcl::PointCloud<PointT>::Ptr input,
77  pcl::PointCloud<pcl::Normal>::Ptr output);
78  virtual void configCallback (Config &config, uint32_t level);
79  virtual void pointCloudToPolygon(const pcl::PointCloud<PointT>& input,
80  geometry_msgs::Polygon& polygon);
81  virtual void pclIndicesArrayToClusterPointIndices(const std::vector<pcl::PointIndices>& inlier_indices,
82  const std_msgs::Header& header,
83  jsk_recognition_msgs::ClusterPointIndices& output_indices);
84  virtual void connectPlanesMap(const pcl::PointCloud<PointT>::Ptr& input,
85  const std::vector<pcl::ModelCoefficients>& model_coefficients,
86  const std::vector<pcl::PointIndices>& boundary_indices,
88  virtual void buildConnectedPlanes(const pcl::PointCloud<PointT>::Ptr& input,
89  const std_msgs::Header& header,
90  const std::vector<pcl::PointIndices>& inlier_indices,
91  const std::vector<pcl::PointIndices>& boundary_indices,
92  const std::vector<pcl::ModelCoefficients>& model_coefficients,
93  const jsk_recognition_utils::IntegerGraphMap& connection_map,
94  std::vector<pcl::PointIndices>& output_indices,
95  std::vector<pcl::ModelCoefficients>& output_coefficients,
96  std::vector<pcl::PointCloud<PointT> >& output_boundary_clouds);
97  virtual void forceToDirectOrigin(const std::vector<pcl::ModelCoefficients>& coefficients,
98  std::vector<pcl::ModelCoefficients>& output_coefficients);
99  virtual void publishMarkerOfConnection(
101  const pcl::PointCloud<PointT>::Ptr cloud,
102  const std::vector<pcl::PointIndices>& inliers,
103  const std_msgs::Header& header);
104 
105  virtual void segmentOrganizedMultiPlanes(
106  pcl::PointCloud<PointT>::Ptr input,
107  pcl::PointCloud<pcl::Normal>::Ptr normal,
108  PlanarRegionVector& regions,
109  std::vector<pcl::ModelCoefficients>& model_coefficients,
110  std::vector<pcl::PointIndices>& inlier_indices,
111  pcl::PointCloud<pcl::Label>::Ptr& labels,
112  std::vector<pcl::PointIndices>& label_indices,
113  std::vector<pcl::PointIndices>& boundary_indices);
114 
115  virtual void segmentFromNormals(pcl::PointCloud<PointT>::Ptr input,
116  pcl::PointCloud<pcl::Normal>::Ptr normal,
117  const std_msgs::Header& header);
118 
119  virtual void publishSegmentationInformation(
120  const std_msgs::Header& header,
121  const pcl::PointCloud<PointT>::Ptr input,
122  ros::Publisher& indices_pub,
123  ros::Publisher& polygon_pub,
125  const std::vector<pcl::PointIndices>& inlier_indices,
126  const std::vector<pcl::PointCloud<PointT> >& boundaries,
127  const std::vector<pcl::ModelCoefficients>& model_coefficients);
128  virtual void publishSegmentationInformation(
129  const std_msgs::Header& header,
130  const pcl::PointCloud<PointT>::Ptr input,
131  ros::Publisher& indices_pub,
132  ros::Publisher& polygon_pub,
134  const std::vector<pcl::PointIndices>& inlier_indices,
135  const std::vector<pcl::PointIndices>& boundary_indices,
136  const std::vector<pcl::ModelCoefficients>& model_coefficients);
137 
138  virtual void refineBasedOnRANSAC(
139  const pcl::PointCloud<PointT>::Ptr input,
140  const std::vector<pcl::PointIndices>& input_indices,
141  const std::vector<pcl::ModelCoefficients>& input_coefficients,
142  std::vector<pcl::PointIndices>& output_indices,
143  std::vector<pcl::ModelCoefficients>& output_coefficients,
144  std::vector<jsk_recognition_utils::ConvexPolygon::Ptr>& output_boundaries);
145 
146 
147  virtual void updateDiagnostics(const ros::TimerEvent& event);
152  virtual void subscribe();
153  virtual void unsubscribe();
155  // ROS variables
172 
189 
191  // parameters for RANSAC refinement
195 
198 
199 
200  private:
201  virtual void onInit();
202  };
203 }
204 
205 #endif
jsk_topic_tools::VitalChecker::Ptr normal_estimation_vital_checker_
jsk_pcl_ros::OrganizedMultiPlaneSegmentationConfig Config
virtual void pclIndicesArrayToClusterPointIndices(const std::vector< pcl::PointIndices > &inlier_indices, const std_msgs::Header &header, jsk_recognition_msgs::ClusterPointIndices &output_indices)
jsk_topic_tools::VitalChecker::Ptr plane_segmentation_vital_checker_
virtual void publishMarkerOfConnection(jsk_recognition_utils::IntegerGraphMap connection_map, const pcl::PointCloud< PointT >::Ptr cloud, const std::vector< pcl::PointIndices > &inliers, const std_msgs::Header &header)
std::map< int, std::vector< int > > IntegerGraphMap
virtual void publishSegmentationInformation(const std_msgs::Header &header, const pcl::PointCloud< PointT >::Ptr input, ros::Publisher &indices_pub, ros::Publisher &polygon_pub, ros::Publisher &coefficients_pub, const std::vector< pcl::PointIndices > &inlier_indices, const std::vector< pcl::PointCloud< PointT > > &boundaries, const std::vector< pcl::ModelCoefficients > &model_coefficients)
virtual void estimateNormal(pcl::PointCloud< PointT >::Ptr input, pcl::PointCloud< pcl::Normal >::Ptr output)
virtual void forceToDirectOrigin(const std::vector< pcl::ModelCoefficients > &coefficients, std::vector< pcl::ModelCoefficients > &output_coefficients)
boost::shared_ptr< diagnostic_updater::Updater > diagnostic_updater_
virtual void segmentOrganizedMultiPlanes(pcl::PointCloud< PointT >::Ptr input, pcl::PointCloud< pcl::Normal >::Ptr normal, PlanarRegionVector &regions, std::vector< pcl::ModelCoefficients > &model_coefficients, std::vector< pcl::PointIndices > &inlier_indices, pcl::PointCloud< pcl::Label >::Ptr &labels, std::vector< pcl::PointIndices > &label_indices, std::vector< pcl::PointIndices > &boundary_indices)
boost::shared_ptr< dynamic_reconfigure::Server< Config > > srv_
virtual void connectPlanesMap(const pcl::PointCloud< PointT >::Ptr &input, const std::vector< pcl::ModelCoefficients > &model_coefficients, const std::vector< pcl::PointIndices > &boundary_indices, jsk_recognition_utils::IntegerGraphMap &connection_map)
virtual void segment(const sensor_msgs::PointCloud2::ConstPtr &msg)
boost::mutex mutex
global mutex.
virtual void updateDiagnosticNormalEstimation(diagnostic_updater::DiagnosticStatusWrapper &stat)
virtual void refineBasedOnRANSAC(const pcl::PointCloud< PointT >::Ptr input, const std::vector< pcl::PointIndices > &input_indices, const std::vector< pcl::ModelCoefficients > &input_coefficients, std::vector< pcl::PointIndices > &output_indices, std::vector< pcl::ModelCoefficients > &output_coefficients, std::vector< jsk_recognition_utils::ConvexPolygon::Ptr > &output_boundaries)
virtual void buildConnectedPlanes(const pcl::PointCloud< PointT >::Ptr &input, const std_msgs::Header &header, const std::vector< pcl::PointIndices > &inlier_indices, const std::vector< pcl::PointIndices > &boundary_indices, const std::vector< pcl::ModelCoefficients > &model_coefficients, const jsk_recognition_utils::IntegerGraphMap &connection_map, std::vector< pcl::PointIndices > &output_indices, std::vector< pcl::ModelCoefficients > &output_coefficients, std::vector< pcl::PointCloud< PointT > > &output_boundary_clouds)
std::vector< pcl::PlanarRegion< PointT >, Eigen::aligned_allocator< pcl::PlanarRegion< PointT > > > PlanarRegionVector
virtual void updateDiagnosticPlaneSegmentation(diagnostic_updater::DiagnosticStatusWrapper &stat)
virtual void segmentFromNormals(pcl::PointCloud< PointT >::Ptr input, pcl::PointCloud< pcl::Normal >::Ptr normal, const std_msgs::Header &header)
virtual void pointCloudToPolygon(const pcl::PointCloud< PointT > &input, geometry_msgs::Polygon &polygon)


jsk_pcl_ros
Author(s): Yohei Kakiuchi
autogenerated on Mon May 3 2021 03:03:47