Main MRPT website > C++ reference for MRPT 1.5.9
PbMapMaker.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 
10 /* Plane-based Map (PbMap) library
11  * Construction of plane-based maps and localization in it from RGBD Images.
12  * Writen by Eduardo Fernandez-Moral. See docs for <a href="group__mrpt__pbmap__grp.html" >mrpt-pbmap</a>
13  */
14 
15 #ifndef __PBMAPMAKER_H
16 #define __PBMAPMAKER_H
17 
18 #include <mrpt/config.h>
19 
20 #if MRPT_HAS_PCL
21 
22 #include <mrpt/utils/utils_defs.h>
23 #include <pcl/visualization/cloud_viewer.h>
24 #include <pcl/visualization/pcl_visualizer.h>
25 #include <mrpt/pbmap/Plane.h>
27 #include <mrpt/pbmap/PbMap.h>
31 #include <set>
32 
33 typedef pcl::PointXYZRGBA PointT;
34 
35 namespace mrpt {
36 namespace pbmap {
37 
38  /*!frameRGBDandPose stores a dupla containing a pointCloud (built from a RGBD frame) and a pose.
39  * \ingroup mrpt_pbmap_grp
40  */
42  {
43  pcl::PointCloud<PointT>::Ptr cloudPtr;
44  Eigen::Matrix4f pose;
45  };
46 
47  /*! This class construct the PbMap extracting planar segments from Range images, which pose must be also provided.
48  * The range images and their poses are communicated with the object frameQueue.
49  * PbMapMaker run its own thread, which is created at initialization.
50  *
51  * \ingroup mrpt_pbmap_grp
52  */
54  {
55  public:
56 
57  /*!PbMapMaker's constructor sets some threshold for plane segmentation and map growing from a configuration file (or default).
58  This constructor also starts PbMapMaker's own thread.*/
59  PbMapMaker(const std::string &config_file);
60 
61  /*!PbMapMaker's destructor is used to save some debugging info to file.*/
62  ~PbMapMaker();
63 
64  /*!Get the PbMap.*/
65  PbMap getPbMap(){return mPbMap;};
66 
67  /*!Serialize the PbMap.*/
68  void serializePbMap(std::string path);
69 
70  /*!frameQueue is a vector containing the frameRGBDandPose (range image + pose) to be processed.*/
71  std::vector<frameRGBDandPose> frameQueue;
72 
73  /*!observedPlanes is a list containing the current observed planes.*/
74  std::set<unsigned> sQueueObservedPlanes;
75 
76  /*!PCL viewer. It runs in a different thread.*/
77  pcl::visualization::CloudViewer cloudViewer;
78 
79  private:
80 
81  /*!Find planar patches in the input organised point cloud "pointCloudPtr_arg", and update the PbMap with them (it update previous planes and
82  initialize new ones when they are first observed), the input pose "poseInv" is used to place the current observations into a common frame of
83  reference. Different thresholds are used to control the plane segmentation:
84  - "distThreshold" defines the maximum distance of an inlier to the plane
85  - "angleThreshold" defines the maximum angle between an inlier's normal and the plane's normal
86  - "minInliersF" defines the minimum number of inliers as a fraction of the total number of points in the input cloud
87  */
88  void detectPlanesCloud( pcl::PointCloud<PointT>::Ptr &pointCloudPtr_arg, Eigen::Matrix4f &poseKF, double distThreshold, double angleThreshold, double minInliersF);
89 
90  /*!Returns true when the closest distance between the patches "plane1" and "plane2" is under distThreshold.*/
91  bool arePlanesNearby(Plane &plane1, Plane &plane2, const float distThreshold);
92 
93  /*!Check for new graph connections of the input plane. These connections are stablished when the minimum distance between two patches is under
94  the input threshold "proximity"*/
95  void checkProximity(Plane &plane, float proximity);
96 
97  /*! Returns true if the two input planes represent the same physical surface for some given angle and distance thresholds.
98  * If the planes are the same they are merged in this and the function returns true. Otherwise it returns false.*/
99  bool areSamePlane(Plane &plane1, Plane &plane2, const float &cosAngleThreshold, const float &distThreshold, const float &proxThreshold);
100 
101  /*! Merge the two input patches into "updatePlane".
102  * Recalculate center, normal vector, area, inlier points (filtered), convex hull, etc.
103  */
104  void mergePlanes(Plane &updatePlane, Plane &discardPlane);
105 
106  /*!File containing some paramteres and heuristic thresholds"*/
108 
109  /*!Object to detect previous places.*/
111 
112  /*!Object to cluster set of planes according to their co-visibility.*/
114 
115  boost::mutex mtx_pbmap_busy;
116 
117  protected:
118 
119  /*!The current PbMap.*/
121 
122  /*!List of planes observed in that last frame introduced.*/
123  std::set<unsigned> observedPlanes;
124 
125  /*!Object to infer some knowledge in the map planes.*/
127 
128  /*!PCL visualizer callback*/
129  void viz_cb (pcl::visualization::PCLVisualizer& viz);
130 
131  /*!This executes the PbMapMaker's thread*/
132  void run();
133 
134  /*!PbMapMaker's thread handle*/
136 
137  /*!PbMapMaker's exit thread*/
138  bool stop_pbMapMaker();
139 
140  /*!PbMapMaker's stop controller*/
142 
143  /*!PbMapMaker's stop var*/
145 
146  // Color paper
147  void watchProperties(std::set<unsigned> &observedPlanes, Plane &observedPlane);
148  void saveInfoFiles();
149  // Unary
150  float rejectAreaF, acceptAreaF, rejectAreaT, acceptAreaT;
151  float rejectElongF, acceptElongF, rejectElongT, acceptElongT;
152  float rejectC1C2C3_F, acceptC1C2C3_F, rejectC1C2C3_T, acceptC1C2C3_T;
153  float rejectNrgb_F, acceptNrgb_F, rejectNrgb_T, acceptNrgb_T;
154  float rejectIntensity_F, acceptIntensity_F, rejectIntensity_T, acceptIntensity_T;
155  float rejectColor_F, acceptColor_F, rejectColor_T, acceptColor_T;
156  float rejectHistH_F, acceptHistH_F, rejectHistH_T, acceptHistH_T;
157  };
158 
159 } } // End of namespaces
160 
161 #endif
162 
163 #endif
PlaneInferredInfo * mpPlaneInferInfo
Definition: PbMapMaker.h:126
std::set< unsigned > observedPlanes
Definition: PbMapMaker.h:123
A class used to store a planar feature (Plane for short).
Definition: Plane.h:48
PbMapLocaliser * mpPbMapLocaliser
Definition: PbMapMaker.h:110
boost::mutex mtx_pbmap_busy
Definition: PbMapMaker.h:115
pcl::PointXYZRGBA PointT
Definition: PbMapMaker.h:33
A class used to infer some semantic meaning to the planes of a PbMap.
mrpt::system::TThreadHandle pbmaker_hd
Definition: PbMapMaker.h:135
SemanticClustering * clusterize
Definition: PbMapMaker.h:113
GLsizei const GLchar ** string
Definition: glext.h:3919
std::set< unsigned > sQueueObservedPlanes
Definition: PbMapMaker.h:74
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
pcl::PointCloud< PointT >::Ptr cloudPtr
Definition: PbMapMaker.h:43
A MRPT thread handle.
Definition: threads.h:28
std::vector< frameRGBDandPose > frameQueue
Definition: PbMapMaker.h:71
A class used to store a Plane-based Map (PbMap).
Definition: pbmap/PbMap.h:45
pcl::visualization::CloudViewer cloudViewer
Definition: PbMapMaker.h:77



Page generated by Doxygen 1.8.14 for MRPT 1.5.9 Git: 690a4699f Wed Apr 15 19:29:53 2020 +0200 at miƩ abr 15 19:30:12 CEST 2020