Main MRPT website > C++ reference for MRPT 1.9.9
CICPCriteriaERD.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 #ifndef CICPCRITERIAERD_H
11 #define CICPCRITERIAERD_H
12 
15 #include <mrpt/img/TColor.h>
19 #include <mrpt/obs/CSensoryFrame.h>
20 #include <mrpt/slam/CICP.h>
21 
22 #include <map>
23 #include <set>
24 #include <string>
25 
27 
28 namespace mrpt
29 {
30 namespace graphslam
31 {
32 namespace deciders
33 {
34 /**\brief ICP-based Edge Registration.
35  *
36  * ## Description
37  *
38  * Register new edges in the graph with the last inserted node. Criterion for
39  * adding new edges should be the goodness of the candidate ICP edge. The
40  * nodes for ICP are picked <em>based on the distance from the last
41  * inserted node</em>.
42  * \sa getNearbyNodesOf
43  *
44  * ### Specifications
45  *
46  * - Map type: 2D
47  * - MRPT rawlog format: #1, #2
48  * - Graph Type: CPosePDFGaussianInf
49  * - Observations: CObservation2DRangeScan, CObservation3DRangeScan
50  * - Edge Registration Strategy: ICP Goodnesss threshold
51  *
52  * ### .ini Configuration Parameters
53  *
54  * \htmlinclude graphslam-engine_config_params_preamble.txt
55  *
56  * - \b class_verbosity
57  * + \a Section : EdgeRegistrationDeciderParameters
58  * + \a default value : 1 (mrpt::system::LVL_INFO)
59  * + \a Required : FALSE
60  *
61  * - \b LC_min_nodeid_diff
62  * + \a Section : GeneralConfiguration
63  * + \a Default value : 30
64  * + \a Required : FALSE
65  * + \a Description : Minimum NodeID difference for an edge to be considered
66  * a loop closure.
67  *
68  * - \b ICP_max_distance
69  * + \a Section : EdgeRegistrationDeciderParameters
70  * + \a Default value : 10 // meters
71  * + \a Required : FALSE
72  * + \a Description : Maximum distance for scan-matching. Decider tries to
73  * align the laser scans of the current node and each of the previous nodes
74  * that are found within the designated ICP_max_distance.
75  *
76  * - \b ICP_goodness_thresh
77  * + \a Section : EdgeRegistrationDeciderParameters
78  * + \a Default value : 0.75
79  * + \a Required : FALSE
80  * + \a Description : Threshold for accepting a scan-matching edge between
81  * the current and previous nodes
82  *
83  * - \b visualize_laser_scans
84  * + \a Section : VisualizationParameters
85  * + \a Default value : TRUE
86  * + \a Required : FALSE
87  *
88  * - \b scans_img_external_dir
89  * + \a Section : EdgeRegistrationDeciderParameters
90  * + \a Default value : . (current directory)
91  * + \a Required : FALSE
92  * + \a Description : Only applicable in datasets with 3DRangeScans that
93  * are externally stored (not stored in the given .rawlog file).
94  *
95  * \ingroup mrpt_graphslam_grp
96  */
97 template <class GRAPH_T = typename mrpt::graphs::CNetworkOfPoses2DInf>
100  GRAPH_T>
101 {
102  public:
103  /**\brief Handy typedefs */
104  /**\{*/
105  /**\brief type of graph constraints */
106  using constraint_t = typename GRAPH_T::constraint_t;
107  /**\brief type of underlying poses (2D/3D). */
108  using pose_t = typename GRAPH_T::constraint_t::type_value;
111  /** self type - Handy type */
114  /**\}*/
115 
116  // Public methods
117  //////////////////////////////////////////////////////////////
118  CICPCriteriaERD();
120 
121  bool updateState(
123  mrpt::obs::CSensoryFrame::Ptr observations,
124  mrpt::obs::CObservation::Ptr observation);
125 
127  const std::map<std::string, bool>& events_occurred);
128  void getEdgesStats(std::map<std::string, int>* edge_types_to_num) const;
129 
130  void initializeVisuals();
131  void updateVisuals();
132  void loadParams(const std::string& source_fname);
133  void printParams() const;
134 
136  {
137  public:
138  TParams(decider_t& d);
139  ~TParams();
140 
141  void loadFromConfigFile(
143  const std::string& section);
144  void dumpToTextStream(std::ostream& out) const;
145 
147  // maximum distance for checking other nodes for ICP constraints
149  // threshold for accepting an ICP constraint in the graph
153  // keystroke to be used for the user to toggle the LaserScans from
154  // the CDisplayWindow
156 
158 
160  };
161  void getDescriptiveReport(std::string* report_str) const;
162 
163  // Public variables
164  // ////////////////////////////
166 
167  protected:
168  // protected functions
169  //////////////////////////////////////////////////////////////
171  const std::set<mrpt::graphs::TNodeID>& nodes_set);
173  const std::set<mrpt::graphs::TNodeID>& nodes_set);
174  void registerNewEdge(
175  const mrpt::graphs::TNodeID& from, const mrpt::graphs::TNodeID& to,
176  const constraint_t& rel_edge);
179  mrpt::obs::CSensoryFrame::Ptr observations,
180  mrpt::obs::CObservation::Ptr observation);
181  /**\brief Get a list of the nodeIDs whose position is within a certain
182  * distance to the specified nodeID
183  */
184  void getNearbyNodesOf(
185  std::set<mrpt::graphs::TNodeID>* nodes_set,
186  const mrpt::graphs::TNodeID& cur_nodeID, double distance);
187  /**\brief togle the LaserScans visualization on and off
188  */
191  std::string viz_flag, int sleep_time = 500 /* ms */);
192 
193  // protected variables
194  //////////////////////////////////////////////////////////////
195 
196  /** see Constructor for initialization */
198  /** see Constructor for initialization */
202 
203  std::map<mrpt::graphs::TNodeID, mrpt::obs::CObservation2DRangeScan::Ptr>
205  std::map<mrpt::graphs::TNodeID, mrpt::obs::CObservation3DRangeScan::Ptr>
207  std::map<std::string, int> m_edge_types_to_nums;
209 
212  // fake 2D laser scan generated from corresponding 3DRangeScan for
213  // visualization reasons
215 };
216 } // namespace deciders
217 } // namespace graphslam
218 } // namespace mrpt
219 
220 #include "CICPCriteriaERD_impl.h"
221 #endif /* end of include guard: CICPCRITERIAERD_H */
mrpt::graphslam::deciders::CICPCriteriaERD::initializeVisuals
void initializeVisuals()
Initialize visual objects in CDisplayWindow (e.g.
Definition: CICPCriteriaERD_impl.h:412
mrpt::obs::CObservation::Ptr
std::shared_ptr< CObservation > Ptr
Definition: CObservation.h:45
mrpt::graphslam::deciders::CICPCriteriaERD::m_text_index_search_disk
int m_text_index_search_disk
Definition: CICPCriteriaERD.h:201
mrpt::graphslam::deciders::CICPCriteriaERD::m_nodes_to_laser_scans2D
std::map< mrpt::graphs::TNodeID, mrpt::obs::CObservation2DRangeScan::Ptr > m_nodes_to_laser_scans2D
Definition: CICPCriteriaERD.h:204
mrpt::graphslam::deciders::CICPCriteriaERD::TParams::ICP_max_distance
double ICP_max_distance
Definition: CICPCriteriaERD.h:148
mrpt::graphslam::deciders::CICPCriteriaERD::m_last_laser_scan3D
mrpt::obs::CObservation3DRangeScan::Ptr m_last_laser_scan3D
Definition: CICPCriteriaERD.h:211
mrpt::obs::CSensoryFrame::Ptr
std::shared_ptr< CSensoryFrame > Ptr
Definition: CSensoryFrame.h:56
mrpt::graphslam::deciders::CICPCriteriaERD::dumpVisibilityErrorMsg
void dumpVisibilityErrorMsg(std::string viz_flag, int sleep_time=500)
Definition: CICPCriteriaERD_impl.h:550
mrpt::graphslam::deciders::CICPCriteriaERD::TParams::LC_min_nodeid_diff
size_t LC_min_nodeid_diff
Definition: CICPCriteriaERD.h:151
mrpt::graphslam::deciders::CICPCriteriaERD::pose_t
typename GRAPH_T::constraint_t::type_value pose_t
type of underlying poses (2D/3D).
Definition: CICPCriteriaERD.h:108
mrpt::graphslam::deciders::CICPCriteriaERD::printParams
void printParams() const
Definition: CICPCriteriaERD_impl.h:585
mrpt::graphslam::deciders::CICPCriteriaERD::m_is_using_3DScan
bool m_is_using_3DScan
Definition: CICPCriteriaERD.h:208
mrpt::graphslam::deciders::CICPCriteriaERD::range_ops_t
typename parent_t::range_ops_t range_ops_t
Definition: CICPCriteriaERD.h:110
mrpt::graphslam::deciders::CICPCriteriaERD::constraint_t
typename GRAPH_T::constraint_t constraint_t
Handy typedefs.
Definition: CICPCriteriaERD.h:106
mrpt::graphs::TNodeID
uint64_t TNodeID
A generic numeric type for unique IDs of nodes or entities.
Definition: TNodeID.h:17
CICP.h
CRangeScanEdgeRegistrationDecider.h
CObservation3DRangeScan.h
mrpt::graphslam::deciders::CICPCriteriaERD::TParams::~TParams
~TParams()
Definition: CICPCriteriaERD_impl.h:640
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
mrpt::math::distance
double distance(const TPoint2D &p1, const TPoint2D &p2)
Gets the distance between two points in a 2D space.
Definition: geometry.cpp:1891
mrpt::graphslam::deciders::CICPCriteriaERD::nodes_to_scans2D_t
typename parent_t::nodes_to_scans2D_t nodes_to_scans2D_t
Definition: CICPCriteriaERD.h:113
mrpt::graphslam::deciders::CICPCriteriaERD::TParams::keystroke_laser_scans
std::string keystroke_laser_scans
Definition: CICPCriteriaERD.h:155
mrpt::graphslam::deciders::CICPCriteriaERD::checkIfInvalidDataset
void checkIfInvalidDataset(mrpt::obs::CActionCollection::Ptr action, mrpt::obs::CSensoryFrame::Ptr observations, mrpt::obs::CObservation::Ptr observation)
CActionCollection.h
mrpt::graphslam::deciders::CICPCriteriaERD::m_last_laser_scan2D
mrpt::obs::CObservation2DRangeScan::Ptr m_last_laser_scan2D
Definition: CICPCriteriaERD.h:210
mrpt::graphslam::deciders::CICPCriteriaERD::getDescriptiveReport
void getDescriptiveReport(std::string *report_str) const
Fill the provided string with a detailed report of the decider/optimizer state.
Definition: CICPCriteriaERD_impl.h:595
source
GLsizei GLsizei GLchar * source
Definition: glext.h:4082
mrpt::graphslam::deciders::CICPCriteriaERD::updateState
bool updateState(mrpt::obs::CActionCollection::Ptr action, mrpt::obs::CSensoryFrame::Ptr observations, mrpt::obs::CObservation::Ptr observation)
Generic method for fetching the incremental action/observation readings from the calling function.
Definition: CICPCriteriaERD_impl.h:54
mrpt::graphslam::deciders::CICPCriteriaERD::m_search_disk_color
mrpt::img::TColor m_search_disk_color
see Constructor for initialization
Definition: CICPCriteriaERD.h:197
mrpt::graphslam::deciders::CICPCriteriaERD::TParams::dumpToTextStream
void dumpToTextStream(std::ostream &out) const
This method should clearly display all the contents of the structure in textual form,...
Definition: CICPCriteriaERD_impl.h:645
mrpt::graphslam::deciders::CICPCriteriaERD::TParams::has_read_config
bool has_read_config
Definition: CICPCriteriaERD.h:159
CConfigFileBase.h
mrpt::graphslam::deciders::CICPCriteriaERD::CICPCriteriaERD
CICPCriteriaERD()
Definition: CICPCriteriaERD_impl.h:24
mrpt::graphslam::deciders::CICPCriteriaERD::TParams
Definition: CICPCriteriaERD.h:135
mrpt::graphslam::deciders::CICPCriteriaERD::m_fake_laser_scan2D
mrpt::obs::CObservation2DRangeScan::Ptr m_fake_laser_scan2D
Definition: CICPCriteriaERD.h:214
mrpt::graphslam::deciders::CICPCriteriaERD::params
TParams params
Definition: CICPCriteriaERD.h:165
mrpt::graphslam::deciders::CICPCriteriaERD::~CICPCriteriaERD
~CICPCriteriaERD()
Definition: CICPCriteriaERD_impl.h:46
mrpt::config::CConfigFileBase
This class allows loading and storing values and vectors of different types from a configuration text...
Definition: config/CConfigFileBase.h:44
mrpt::graphslam::deciders::CICPCriteriaERD::TParams::decider
decider_t & decider
Definition: CICPCriteriaERD.h:146
mrpt::graphslam::deciders::CICPCriteriaERD::TParams::visualize_laser_scans
bool visualize_laser_scans
Definition: CICPCriteriaERD.h:152
mrpt::img::TColor
A RGB color - 8bit.
Definition: TColor.h:22
mrpt::config::CLoadableOptions
This is a virtual base class for sets of options than can be loaded from and/or saved to configuratio...
Definition: config/CLoadableOptions.h:28
mrpt::graphslam::deciders::CICPCriteriaERD::toggleLaserScansVisualization
void toggleLaserScansVisualization()
togle the LaserScans visualization on and off
Definition: CICPCriteriaERD_impl.h:371
CICPCriteriaERD_impl.h
mrpt::graphslam::deciders::CICPCriteriaERD::loadParams
void loadParams(const std::string &source_fname)
Fetch the latest observation that the current instance received (most probably during a call to the u...
Definition: CICPCriteriaERD_impl.h:567
mrpt::graphslam::deciders::CRangeScanEdgeRegistrationDecider::range_ops_t
mrpt::graphslam::deciders::CRangeScanOps< GRAPH_T > range_ops_t
Typedef for accessing methods of the RangeScanRegistrationDecider_t parent class.
Definition: CRangeScanEdgeRegistrationDecider.h:44
mrpt::graphslam::deciders::CICPCriteriaERD::notifyOfWindowEvents
void notifyOfWindowEvents(const std::map< std::string, bool > &events_occurred)
Get a list of the window events that happened since the last call.
Definition: CICPCriteriaERD_impl.h:355
mrpt::graphslam::deciders::CRangeScanEdgeRegistrationDecider::nodes_to_scans2D_t
std::map< mrpt::graphs::TNodeID, mrpt::obs::CObservation2DRangeScan::Ptr > nodes_to_scans2D_t
Definition: CRangeScanEdgeRegistrationDecider.h:46
mrpt::graphslam::deciders::CICPCriteriaERD::m_nodes_to_laser_scans3D
std::map< mrpt::graphs::TNodeID, mrpt::obs::CObservation3DRangeScan::Ptr > m_nodes_to_laser_scans3D
Definition: CICPCriteriaERD.h:206
mrpt::graphslam::deciders::CICPCriteriaERD::checkRegistrationCondition3D
void checkRegistrationCondition3D(const std::set< mrpt::graphs::TNodeID > &nodes_set)
Definition: CICPCriteriaERD_impl.h:250
mrpt::obs::CObservation2DRangeScan::Ptr
std::shared_ptr< CObservation2DRangeScan > Ptr
Definition: CObservation2DRangeScan.h:58
CSensoryFrame.h
mrpt::graphslam::deciders::CICPCriteriaERD::getEdgesStats
void getEdgesStats(std::map< std::string, int > *edge_types_to_num) const
Fill the given map with the type of registered edges as well as the corresponding number of registrat...
Definition: CICPCriteriaERD_impl.h:401
CLoadableOptions.h
mrpt::graphslam::deciders::CICPCriteriaERD
ICP-based Edge Registration.
Definition: CICPCriteriaERD.h:98
mrpt::graphslam::deciders::CRangeScanEdgeRegistrationDecider
Edge Registration Decider Interface from which RangeScanner-based ERDs can inherit from.
Definition: CRangeScanEdgeRegistrationDecider.h:34
mrpt::obs::CObservation3DRangeScan::Ptr
std::shared_ptr< CObservation3DRangeScan > Ptr
Definition: CObservation3DRangeScan.h:226
mrpt::graphslam::deciders::CICPCriteriaERD::getNearbyNodesOf
void getNearbyNodesOf(std::set< mrpt::graphs::TNodeID > *nodes_set, const mrpt::graphs::TNodeID &cur_nodeID, double distance)
Get a list of the nodeIDs whose position is within a certain distance to the specified nodeID.
Definition: CICPCriteriaERD_impl.h:326
string
GLsizei const GLchar ** string
Definition: glext.h:4101
mrpt::graphslam::deciders::CICPCriteriaERD::registerNewEdge
void registerNewEdge(const mrpt::graphs::TNodeID &from, const mrpt::graphs::TNodeID &to, const constraint_t &rel_edge)
Definition: CICPCriteriaERD_impl.h:316
mrpt::graphslam::deciders::CICPCriteriaERD::m_offset_y_search_disk
double m_offset_y_search_disk
Definition: CICPCriteriaERD.h:200
mrpt::graphslam::deciders::CICPCriteriaERD::m_edge_types_to_nums
std::map< std::string, int > m_edge_types_to_nums
Definition: CICPCriteriaERD.h:207
mrpt::obs::CActionCollection::Ptr
std::shared_ptr< CActionCollection > Ptr
Definition: CActionCollection.h:30
mrpt::graphslam::deciders::CICPCriteriaERD::TParams::scans_img_external_dir
std::string scans_img_external_dir
Definition: CICPCriteriaERD.h:157
mrpt::graphslam::deciders::CICPCriteriaERD::checkRegistrationCondition2D
void checkRegistrationCondition2D(const std::set< mrpt::graphs::TNodeID > &nodes_set)
Definition: CICPCriteriaERD_impl.h:167
mrpt::graphslam::deciders::CICPCriteriaERD::TParams::ICP_goodness_thresh
double ICP_goodness_thresh
Definition: CICPCriteriaERD.h:150
TColor.h
mrpt::graphslam::deciders::CICPCriteriaERD::updateVisuals
void updateVisuals()
Update the relevant visual features in CDisplayWindow.
Definition: CICPCriteriaERD_impl.h:481
mrpt::graphslam::deciders::CICPCriteriaERD::TParams::loadFromConfigFile
void loadFromConfigFile(const mrpt::config::CConfigFileBase &source, const std::string &section)
This method load the options from a ".ini"-like file or memory-stored string list.
Definition: CICPCriteriaERD_impl.h:669
mrpt::graphslam::deciders::CICPCriteriaERD::TParams::TParams
TParams(decider_t &d)
Definition: CICPCriteriaERD_impl.h:634
CObservation2DRangeScan.h
mrpt::graphslam::deciders::CICPCriteriaERD::m_laser_scans_color
mrpt::img::TColor m_laser_scans_color
see Constructor for initialization
Definition: CICPCriteriaERD.h:199



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