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



Page generated by Doxygen 1.8.20 for MRPT 1.4.0 SVN: at Thu Aug 27 02:40:23 UTC 2020