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



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST