environment_plane_modeling.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/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_ENVIRONMENT_PLANE_MODELING_H_
37 #define JSK_PCL_ROS_ENVIRONMENT_PLANE_MODELING_H_
38 
39 #include <pcl_ros/pcl_nodelet.h>
40 
41 #include <pcl/kdtree/kdtree_flann.h>
45 #include <dynamic_reconfigure/server.h>
46 
47 #include <jsk_recognition_msgs/PolygonArray.h>
48 #include <jsk_recognition_msgs/ModelCoefficientsArray.h>
49 #include <jsk_recognition_msgs/ClusterPointIndices.h>
50 #include <sensor_msgs/PointCloud2.h>
51 #include <jsk_recognition_msgs/EnvironmentLock.h>
52 #include <jsk_recognition_msgs/PolygonOnEnvironment.h>
53 
55 #include <jsk_pcl_ros/EnvironmentPlaneModelingConfig.h>
56 
59 
60 #include <std_srvs/Empty.h>
61 
63 
65 #include <jsk_recognition_msgs/SimpleOccupancyGridArray.h>
66 #include <jsk_recognition_msgs/BoundingBoxArray.h>
70 
71 namespace jsk_pcl_ros
72 {
73 
74  // Helper classes
75 
81  {
82  public:
83  typedef EnvironmentPlaneModelingConfig Config;
84 
86  sensor_msgs::PointCloud2,
87  sensor_msgs::PointCloud2,
88  jsk_recognition_msgs::PolygonArray,
89  jsk_recognition_msgs::ModelCoefficientsArray,
90  jsk_recognition_msgs::ClusterPointIndices > SyncPolicy;
91  EnvironmentPlaneModeling(): DiagnosticNodelet("EnvironmentPlaneModeling") {}
92  protected:
93  virtual void onInit();
94 
100  virtual void subscribe() {}
101 
107  virtual void unsubscribe() {}
108 
113  virtual void inputCallback(
114  const sensor_msgs::PointCloud2::ConstPtr& cloud_msg,
115  const sensor_msgs::PointCloud2::ConstPtr& full_cloud_msg,
116  const jsk_recognition_msgs::PolygonArray::ConstPtr& polygon_msg,
117  const jsk_recognition_msgs::ModelCoefficientsArray::ConstPtr& coefficients_msg,
118  const jsk_recognition_msgs::ClusterPointIndices::ConstPtr& indices_msg);
119 
120  virtual void printInputData(
121  const sensor_msgs::PointCloud2::ConstPtr& cloud_msg,
122  const sensor_msgs::PointCloud2::ConstPtr& full_cloud_msg,
123  const jsk_recognition_msgs::PolygonArray::ConstPtr& polygon_msg,
124  const jsk_recognition_msgs::ModelCoefficientsArray::ConstPtr& coefficients_msg,
125  const jsk_recognition_msgs::ClusterPointIndices::ConstPtr& indices_msg);
126 
127 
128  virtual bool isValidFrameIds(
129  const sensor_msgs::PointCloud2::ConstPtr& cloud_msg,
130  const sensor_msgs::PointCloud2::ConstPtr& full_cloud_msg,
131  const jsk_recognition_msgs::PolygonArray::ConstPtr& polygon_msg,
132  const jsk_recognition_msgs::ModelCoefficientsArray::ConstPtr& coefficients_msg,
133  const jsk_recognition_msgs::ClusterPointIndices::ConstPtr& indices_msg);
134 
135  virtual std::vector<jsk_recognition_utils::ConvexPolygon::Ptr> convertToConvexPolygons(
136  const pcl::PointCloud<pcl::PointNormal>::Ptr& cloud,
137  const jsk_recognition_msgs::ClusterPointIndices::ConstPtr& indices_msg,
138  const jsk_recognition_msgs::ModelCoefficientsArray::ConstPtr& coefficients_msg);
139 
140  virtual void publishConvexPolygonsBoundaries(
142  const std_msgs::Header& header,
143  std::vector<jsk_recognition_utils::ConvexPolygon::Ptr>& convexes);
144 
149  virtual void configCallback(Config &config, uint32_t level);
150 
155  virtual void publishConvexPolygons(
156  ros::Publisher& pub,
157  const std_msgs::Header& header,
158  std::vector<jsk_recognition_utils::ConvexPolygon::Ptr>& convexes);
159 
164  virtual void publishGridMaps(
165  ros::Publisher& pub,
166  const std_msgs::Header& header,
167  std::vector<GridPlane::Ptr>& grids);
168 
173  virtual std::vector<jsk_recognition_utils::ConvexPolygon::Ptr> magnifyConvexes(
174  std::vector<jsk_recognition_utils::ConvexPolygon::Ptr>& convexes);
175 
180  virtual std::vector<GridPlane::Ptr> buildGridPlanes(
181  pcl::PointCloud<pcl::PointNormal>::Ptr& cloud,
182  std::vector<jsk_recognition_utils::ConvexPolygon::Ptr> convexes,
183  std::set<int>& non_plane_indices);
184 
185  virtual std::vector<GridPlane::Ptr> morphologicalFiltering(
186  std::vector<GridPlane::Ptr>& raw_grid_maps);
187 
188  virtual void boundingBoxCallback(
189  const jsk_recognition_msgs::BoundingBox::ConstPtr& box_array);
190 
191  virtual std::vector<GridPlane::Ptr> completeFootprintRegion(
192  const std_msgs::Header& header,
193  std::vector<GridPlane::Ptr>& grid_maps);
194 
195  virtual std::vector<GridPlane::Ptr> erodeFiltering(
196  std::vector<GridPlane::Ptr>& grid_maps);
197 
198  virtual int lookupGroundPlaneForFootprint(
199  const std::string& footprint_frame_id, const std_msgs::Header& header,
200  const std::vector<GridPlane::Ptr>& grid_maps);
201 
202  virtual int lookupGroundPlaneForFootprint(
203  const Eigen::Affine3f& pose, const std::vector<GridPlane::Ptr>& grid_maps);
204 
206  const jsk_recognition_msgs::BoundingBox::ConstPtr& box,
207  const std_msgs::Header& header,
208  GridPlane::Ptr grid_map);
209 
210  virtual void moveBaseSimpleGoalCallback(
211  const geometry_msgs::PoseStamped::ConstPtr& msg);
212 
233  jsk_recognition_msgs::BoundingBox::ConstPtr latest_leg_bounding_box_;
234  std::vector<std::string> footprint_frames_;
235  std::vector<GridPlane::Ptr> latest_grid_maps_;
236  std_msgs::Header latest_global_header_;
238  // Parameters
243  double resolution_;
249  private:
250  };
251 }
252 
253 #endif
virtual std::vector< jsk_recognition_utils::ConvexPolygon::Ptr > magnifyConvexes(std::vector< jsk_recognition_utils::ConvexPolygon::Ptr > &convexes)
Magnify jsk_recognition_utils::ConvexPolygons according to maginify_distance_ parameter.
virtual void configCallback(Config &config, uint32_t level)
Callback method of dynamic reconfigure.
virtual GridPlane::Ptr completeGridMapByBoundingBox(const jsk_recognition_msgs::BoundingBox::ConstPtr &box, const std_msgs::Header &header, GridPlane::Ptr grid_map)
virtual std::vector< GridPlane::Ptr > completeFootprintRegion(const std_msgs::Header &header, std::vector< GridPlane::Ptr > &grid_maps)
virtual std::vector< jsk_recognition_utils::ConvexPolygon::Ptr > convertToConvexPolygons(const pcl::PointCloud< pcl::PointNormal >::Ptr &cloud, const jsk_recognition_msgs::ClusterPointIndices::ConstPtr &indices_msg, const jsk_recognition_msgs::ModelCoefficientsArray::ConstPtr &coefficients_msg)
message_filters::Subscriber< jsk_recognition_msgs::ModelCoefficientsArray > sub_coefficients_
message_filters::Subscriber< sensor_msgs::PointCloud2 > sub_cloud_
config
virtual std::vector< GridPlane::Ptr > erodeFiltering(std::vector< GridPlane::Ptr > &grid_maps)
message_filters::Subscriber< jsk_recognition_msgs::ClusterPointIndices > sub_indices_
pose
virtual std::vector< GridPlane::Ptr > morphologicalFiltering(std::vector< GridPlane::Ptr > &raw_grid_maps)
virtual void unsubscribe()
unsubscription callback function of jsk_topic_tools::DiagnosticNodelet. This method is empty method b...
virtual void boundingBoxCallback(const jsk_recognition_msgs::BoundingBox::ConstPtr &box_array)
virtual void publishConvexPolygonsBoundaries(ros::Publisher &pub, const std_msgs::Header &header, std::vector< jsk_recognition_utils::ConvexPolygon::Ptr > &convexes)
virtual void inputCallback(const sensor_msgs::PointCloud2::ConstPtr &cloud_msg, const sensor_msgs::PointCloud2::ConstPtr &full_cloud_msg, const jsk_recognition_msgs::PolygonArray::ConstPtr &polygon_msg, const jsk_recognition_msgs::ModelCoefficientsArray::ConstPtr &coefficients_msg, const jsk_recognition_msgs::ClusterPointIndices::ConstPtr &indices_msg)
main callback function
message_filters::Subscriber< sensor_msgs::PointCloud2 > sub_full_cloud_
DiagnosticNodelet(const std::string &name)
Nodelet implementation of jsk_pcl/EnvironmentPlaneModeling.
message_filters::Subscriber< jsk_recognition_msgs::PolygonArray > sub_polygons_
virtual void moveBaseSimpleGoalCallback(const geometry_msgs::PoseStamped::ConstPtr &msg)
boost::shared_ptr< dynamic_reconfigure::Server< Config > > srv_
jsk_recognition_msgs::PolygonArray::ConstPtr polygon_msg
virtual std::vector< GridPlane::Ptr > buildGridPlanes(pcl::PointCloud< pcl::PointNormal >::Ptr &cloud, std::vector< jsk_recognition_utils::ConvexPolygon::Ptr > convexes, std::set< int > &non_plane_indices)
make GridPlane from jsk_recognition_utils::ConvexPolygon and PointCloud
virtual void printInputData(const sensor_msgs::PointCloud2::ConstPtr &cloud_msg, const sensor_msgs::PointCloud2::ConstPtr &full_cloud_msg, const jsk_recognition_msgs::PolygonArray::ConstPtr &polygon_msg, const jsk_recognition_msgs::ModelCoefficientsArray::ConstPtr &coefficients_msg, const jsk_recognition_msgs::ClusterPointIndices::ConstPtr &indices_msg)
virtual bool isValidFrameIds(const sensor_msgs::PointCloud2::ConstPtr &cloud_msg, const sensor_msgs::PointCloud2::ConstPtr &full_cloud_msg, const jsk_recognition_msgs::PolygonArray::ConstPtr &polygon_msg, const jsk_recognition_msgs::ModelCoefficientsArray::ConstPtr &coefficients_msg, const jsk_recognition_msgs::ClusterPointIndices::ConstPtr &indices_msg)
virtual void publishConvexPolygons(ros::Publisher &pub, const std_msgs::Header &header, std::vector< jsk_recognition_utils::ConvexPolygon::Ptr > &convexes)
Publish array of jsk_recognition_utils::ConvexPolygon::Ptr by using specified publisher.
boost::shared_ptr< message_filters::Synchronizer< SyncPolicy > > sync_
virtual void subscribe()
subscription callback function of jsk_topic_tools::DiagnosticNodelet. This method is empty method bec...
boost::mutex mutex
global mutex.
virtual int lookupGroundPlaneForFootprint(const std::string &footprint_frame_id, const std_msgs::Header &header, const std::vector< GridPlane::Ptr > &grid_maps)
std::vector< GridPlane::Ptr > latest_grid_maps_
cloud
message_filters::sync_policies::ExactTime< sensor_msgs::PointCloud2, sensor_msgs::PointCloud2, jsk_recognition_msgs::PolygonArray, jsk_recognition_msgs::ModelCoefficientsArray, jsk_recognition_msgs::ClusterPointIndices > SyncPolicy
virtual void publishGridMaps(ros::Publisher &pub, const std_msgs::Header &header, std::vector< GridPlane::Ptr > &grids)
Publish array of GridPlane::Ptr by using specified publisher.
jsk_recognition_msgs::BoundingBox::ConstPtr latest_leg_bounding_box_


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