plane_reasoner.h
Go to the documentation of this file.
1 // -*- mode: c++ -*-
2 /*********************************************************************
3  * Software License Agreement (BSD License)
4  *
5  * Copyright (c) 2014, 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/or 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 
37 #ifndef JSK_PCL_ROS_UTILS_PLANE_REASONER_H_
38 #define JSK_PCL_ROS_UTILS_PLANE_REASONER_H_
39 
40 #include <jsk_topic_tools/diagnostic_nodelet.h>
41 #include "jsk_recognition_msgs/ClusterPointIndices.h"
42 #include "jsk_recognition_msgs/PolygonArray.h"
43 #include "jsk_recognition_msgs/ModelCoefficientsArray.h"
44 
49 
50 #include <dynamic_reconfigure/server.h>
51 #include "jsk_pcl_ros_utils/PlaneReasonerConfig.h"
52 
54 
55 namespace jsk_pcl_ros_utils
56 {
57  typedef boost::tuple<pcl::PointIndices::Ptr,
58  pcl::ModelCoefficients::Ptr,
60  geometry_msgs::PolygonStamped>
62 
63  class PlaneReasoner: public jsk_topic_tools::DiagnosticNodelet
64  {
65  public:
67  // typedefs
70  sensor_msgs::PointCloud2,
71  jsk_recognition_msgs::ClusterPointIndices,
72  jsk_recognition_msgs::ModelCoefficientsArray,
73  jsk_recognition_msgs::PolygonArray> SyncPolicy;
74  typedef jsk_pcl_ros_utils::PlaneReasonerConfig Config;
75  typedef pcl::PointXYZRGB PointT;
76 
77 
78  PlaneReasoner(): DiagnosticNodelet("PlaneReasoner") { }
79  virtual ~PlaneReasoner();
80 
81  protected:
83  // Methods
85  virtual void onInit();
86 
87  virtual void subscribe();
88 
89  virtual void unsubscribe();
90 
91  virtual void reason(
92  const sensor_msgs::PointCloud2::ConstPtr& cloud_msg,
93  const jsk_recognition_msgs::ClusterPointIndices::ConstPtr& inliers_msg,
94  const jsk_recognition_msgs::ModelCoefficientsArray::ConstPtr& coefficients_msg,
95  const jsk_recognition_msgs::PolygonArray::ConstPtr& polygons_msg);
96 
97  virtual void configCallback (Config &config, uint32_t level);
98 
99  virtual std::vector<PlaneInfoContainer>
100  packInfo(std::vector<pcl::PointIndices::Ptr>& inliers,
101  std::vector<pcl::ModelCoefficients::Ptr>& coefficients,
102  std::vector<jsk_recognition_utils::Plane::Ptr>& planes,
103  std::vector<geometry_msgs::PolygonStamped>& polygons);
104 
105  virtual std::vector<PlaneInfoContainer>
107  std::vector<PlaneInfoContainer>& infos);
108 
109  virtual std::vector<PlaneInfoContainer>
111  std::vector<PlaneInfoContainer>& infos);
112 
113  virtual std::vector<PlaneInfoContainer>
115  double reference_angle,
116  double thrshold,
117  std::vector<PlaneInfoContainer>& infos);
118 
119  virtual void publishPlaneInfo(
120  std::vector<PlaneInfoContainer>& containers,
121  const std_msgs::Header& header,
122  pcl::PointCloud<PointT>::Ptr cloud,
123  ros::Publisher& pub_inlier,
124  ros::Publisher& pub_coefficients,
125  ros::Publisher& pub_polygons);
126 
128  // ROS variables
143 
144  boost::mutex mutex_;
145 
147  // parameters
149  std::string global_frame_id_;
152  private:
153 
154  };
155 }
156 
157 #endif
jsk_pcl_ros_utils
Definition: add_point_indices.h:51
jsk_pcl_ros_utils::PlaneReasoner::pub_horizontal_polygons_
ros::Publisher pub_horizontal_polygons_
Definition: plane_reasoner.h:174
jsk_pcl_ros_utils::PlaneReasoner::sub_polygons_
message_filters::Subscriber< jsk_recognition_msgs::PolygonArray > sub_polygons_
Definition: plane_reasoner.h:165
jsk_pcl_ros_utils::PlaneReasoner::sub_coefficients_
message_filters::Subscriber< jsk_recognition_msgs::ModelCoefficientsArray > sub_coefficients_
Definition: plane_reasoner.h:164
ros::Publisher
jsk_pcl_ros_utils::PlaneReasoner::vertical_angular_threshold_
double vertical_angular_threshold_
Definition: plane_reasoner.h:183
boost::shared_ptr
jsk_pcl_ros_utils::PlaneReasoner::filterVerticalPlanes
virtual std::vector< PlaneInfoContainer > filterVerticalPlanes(std::vector< PlaneInfoContainer > &infos)
Definition: plane_reasoner_nodelet.cpp:282
jsk_pcl_ros_utils::PlaneReasoner::pub_vertical_coefficients_
ros::Publisher pub_vertical_coefficients_
Definition: plane_reasoner.h:170
geo_util.h
jsk_pcl_ros_utils::PlaneInfoContainer
boost::tuple< pcl::PointIndices::Ptr, pcl::ModelCoefficients::Ptr, jsk_recognition_utils::Plane::Ptr, geometry_msgs::PolygonStamped > PlaneInfoContainer
Definition: plane_reasoner.h:93
time_synchronizer.h
jsk_pcl_ros_utils::PlaneReasoner::PlaneReasoner
PlaneReasoner()
Definition: plane_reasoner.h:110
jsk_pcl_ros_utils::PlaneReasoner::sync_
boost::shared_ptr< message_filters::Synchronizer< SyncPolicy > > sync_
Definition: plane_reasoner.h:166
jsk_pcl_ros_utils::PlaneReasoner::pub_vertical_inliers_
ros::Publisher pub_vertical_inliers_
Definition: plane_reasoner.h:169
jsk_pcl_ros_utils::PlaneReasoner::pub_horizontal_coefficients_
ros::Publisher pub_horizontal_coefficients_
Definition: plane_reasoner.h:173
sample_camera_info_and_pointcloud_publisher.cloud
cloud
Definition: sample_camera_info_and_pointcloud_publisher.py:30
message_filters::Subscriber< sensor_msgs::PointCloud2 >
jsk_pcl_ros_utils::PlaneReasoner::filterPlanesAroundAngle
virtual std::vector< PlaneInfoContainer > filterPlanesAroundAngle(double reference_angle, double thrshold, std::vector< PlaneInfoContainer > &infos)
Definition: plane_reasoner_nodelet.cpp:235
jsk_pcl_ros_utils::PlaneReasoner::subscribe
virtual void subscribe()
Definition: plane_reasoner_nodelet.cpp:121
jsk_pcl_ros_utils::PlaneReasoner::horizontal_angular_threshold_
double horizontal_angular_threshold_
Definition: plane_reasoner.h:182
jsk_pcl_ros_utils::PlaneReasoner::configCallback
virtual void configCallback(Config &config, uint32_t level)
Definition: plane_reasoner_nodelet.cpp:146
jsk_pcl_ros_utils::PlaneReasoner::onInit
virtual void onInit()
Definition: plane_reasoner_nodelet.cpp:74
jsk_recognition_utils::Plane::Ptr
boost::shared_ptr< Plane > Ptr
subscriber.h
jsk_pcl_ros_utils::PlaneReasoner::srv_
boost::shared_ptr< dynamic_reconfigure::Server< Config > > srv_
Definition: plane_reasoner.h:167
jsk_pcl_ros_utils::PlaneReasoner::pub_vertical_polygons_
ros::Publisher pub_vertical_polygons_
Definition: plane_reasoner.h:171
jsk_pcl_ros_utils::PlaneReasoner::PointT
pcl::PointXYZRGB PointT
Definition: plane_reasoner.h:107
jsk_pcl_ros_utils::PlaneReasoner::SyncPolicy
message_filters::sync_policies::ExactTime< sensor_msgs::PointCloud2, jsk_recognition_msgs::ClusterPointIndices, jsk_recognition_msgs::ModelCoefficientsArray, jsk_recognition_msgs::PolygonArray > SyncPolicy
Definition: plane_reasoner.h:105
jsk_pcl_ros_utils::PlaneReasoner::reason
virtual void reason(const sensor_msgs::PointCloud2::ConstPtr &cloud_msg, const jsk_recognition_msgs::ClusterPointIndices::ConstPtr &inliers_msg, const jsk_recognition_msgs::ModelCoefficientsArray::ConstPtr &coefficients_msg, const jsk_recognition_msgs::PolygonArray::ConstPtr &polygons_msg)
Definition: plane_reasoner_nodelet.cpp:154
jsk_pcl_ros_utils::PlaneReasoner::pub_horizontal_inliers_
ros::Publisher pub_horizontal_inliers_
Definition: plane_reasoner.h:172
jsk_pcl_ros_utils::PlaneReasoner::global_frame_id_
std::string global_frame_id_
Definition: plane_reasoner.h:181
jsk_pcl_ros_utils::PlaneReasoner::publishPlaneInfo
virtual void publishPlaneInfo(std::vector< PlaneInfoContainer > &containers, const std_msgs::Header &header, pcl::PointCloud< PointT >::Ptr cloud, ros::Publisher &pub_inlier, ros::Publisher &pub_coefficients, ros::Publisher &pub_polygons)
Definition: plane_reasoner_nodelet.cpp:201
jsk_pcl_ros_utils::PlaneReasoner::~PlaneReasoner
virtual ~PlaneReasoner()
Definition: plane_reasoner_nodelet.cpp:110
jsk_pcl_ros_utils::PlaneReasoner::unsubscribe
virtual void unsubscribe()
Definition: plane_reasoner_nodelet.cpp:137
tf::TransformListener
jsk_pcl_ros_utils::PlaneReasoner::packInfo
virtual std::vector< PlaneInfoContainer > packInfo(std::vector< pcl::PointIndices::Ptr > &inliers, std::vector< pcl::ModelCoefficients::Ptr > &coefficients, std::vector< jsk_recognition_utils::Plane::Ptr > &planes, std::vector< geometry_msgs::PolygonStamped > &polygons)
Definition: plane_reasoner_nodelet.cpp:292
jsk_pcl_ros_utils::PlaneReasoner::Config
jsk_pcl_ros_utils::PlaneReasonerConfig Config
Definition: plane_reasoner.h:106
synchronizer.h
jsk_pcl_ros_utils::PlaneReasoner::sub_input_
message_filters::Subscriber< sensor_msgs::PointCloud2 > sub_input_
Definition: plane_reasoner.h:162
jsk_pcl_ros_utils::PlaneReasoner::mutex_
boost::mutex mutex_
Definition: plane_reasoner.h:176
jsk_pcl_ros_utils::PlaneReasoner::filterHorizontalPlanes
virtual std::vector< PlaneInfoContainer > filterHorizontalPlanes(std::vector< PlaneInfoContainer > &infos)
Definition: plane_reasoner_nodelet.cpp:272
tf_listener_singleton.h
message_filters::sync_policies::ExactTime
jsk_pcl_ros_utils::PlaneReasoner::sub_inliers_
message_filters::Subscriber< jsk_recognition_msgs::ClusterPointIndices > sub_inliers_
Definition: plane_reasoner.h:163
jsk_pcl_ros_utils::PlaneReasoner::tf_listener_
tf::TransformListener * tf_listener_
Definition: plane_reasoner.h:168


jsk_pcl_ros_utils
Author(s): Yohei Kakiuchi
autogenerated on Fri May 16 2025 03:11:43