Main MRPT website > C++ reference for MRPT 1.4.0
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-2016, 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
mrpt::pbmap::PbMapMaker::rejectHistH_T
float rejectHistH_T
Definition: PbMapMaker.h:156
mrpt::pbmap::PbMapMaker::pbmaker_hd
mrpt::system::TThreadHandle pbmaker_hd
Definition: PbMapMaker.h:135
Plane.h
mrpt::pbmap::PbMapLocaliser
Definition: PbMapLocaliser.h:40
mrpt::pbmap::PbMapMaker::config_Param
FILE * config_Param
Definition: PbMapMaker.h:107
mrpt::pbmap::PbMapMaker::m_pbmaker_finished
bool m_pbmaker_finished
Definition: PbMapMaker.h:144
PointT
pcl::PointXYZRGBA PointT
Definition: PbMapMaker.h:33
mrpt::pbmap::PbMapMaker::rejectNrgb_T
float rejectNrgb_T
Definition: PbMapMaker.h:153
utils_defs.h
PlaneInferredInfo.h
mrpt::pbmap::PbMapMaker::rejectIntensity_T
float rejectIntensity_T
Definition: PbMapMaker.h:154
mrpt::pbmap::PbMapMaker
Definition: PbMapMaker.h:53
mrpt::pbmap::PbMapMaker::observedPlanes
std::set< unsigned > observedPlanes
Definition: PbMapMaker.h:123
mrpt::pbmap::PbMapMaker::rejectElongT
float rejectElongT
Definition: PbMapMaker.h:151
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CParticleFilter.h:16
mrpt::pbmap::PbMapMaker::sQueueObservedPlanes
std::set< unsigned > sQueueObservedPlanes
Definition: PbMapMaker.h:74
mrpt::pbmap::frameRGBDandPose
Definition: PbMapMaker.h:41
SemanticClustering.h
mrpt::pbmap::PbMapMaker::mtx_pbmap_busy
boost::mutex mtx_pbmap_busy
Definition: PbMapMaker.h:115
mrpt::pbmap::frameRGBDandPose::cloudPtr
pcl::PointCloud< PointT >::Ptr cloudPtr
Definition: PbMapMaker.h:43
mrpt::pbmap::Plane
A class used to store a planar feature (Plane for short).
Definition: Plane.h:48
mrpt::pbmap::frameRGBDandPose::pose
Eigen::Matrix4f pose
Definition: PbMapMaker.h:44
mrpt::pbmap::PbMapMaker::mpPlaneInferInfo
PlaneInferredInfo * mpPlaneInferInfo
Definition: PbMapMaker.h:126
mrpt::pbmap::PbMapMaker::rejectColor_T
float rejectColor_T
Definition: PbMapMaker.h:155
mrpt::pbmap::PbMap
A class used to store a Plane-based Map (PbMap).
Definition: pbmap/PbMap.h:45
mrpt::pbmap::PbMapMaker::m_pbmaker_must_stop
bool m_pbmaker_must_stop
Definition: PbMapMaker.h:141
mrpt::system::TThreadHandle
This structure contains the information needed to interface the threads API on each platform:
Definition: threads.h:25
mrpt::pbmap::PbMapMaker::mPbMap
PbMap mPbMap
Definition: PbMapMaker.h:120
mrpt::pbmap::SemanticClustering
Definition: SemanticClustering.h:44
mrpt::pbmap::PbMapMaker::clusterize
SemanticClustering * clusterize
Definition: PbMapMaker.h:113
mrpt::pbmap::PbMapMaker::rejectAreaT
float rejectAreaT
Definition: PbMapMaker.h:150
mrpt::pbmap::PbMapMaker::cloudViewer
pcl::visualization::CloudViewer cloudViewer
Definition: PbMapMaker.h:77
PbMapLocaliser.h
mrpt::pbmap::PbMapMaker::getPbMap
PbMap getPbMap()
Definition: PbMapMaker.h:65
mrpt::pbmap::PbMapMaker::rejectC1C2C3_T
float rejectC1C2C3_T
Definition: PbMapMaker.h:152
mrpt::pbmap::PbMapMaker::frameQueue
std::vector< frameRGBDandPose > frameQueue
Definition: PbMapMaker.h:71
PbMap.h
mrpt::pbmap::PbMapMaker::mpPbMapLocaliser
PbMapLocaliser * mpPbMapLocaliser
Definition: PbMapMaker.h:110
mrpt::pbmap::PlaneInferredInfo
A class used to infer some semantic meaning to the planes of a PbMap.
Definition: PlaneInferredInfo.h:36



Page generated by Doxygen 1.8.16 for MRPT 1.4.0 SVN: at Mon Oct 14 22:32:58 UTC 2019