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 
29 {
30 /**\brief ICP-based Edge Registration.
31  *
32  * ## Description
33  *
34  * Register new edges in the graph with the last inserted node. Criterion for
35  * adding new edges should be the goodness of the candidate ICP edge. The
36  * nodes for ICP are picked <em>based on the distance from the last
37  * inserted node</em>.
38  * \sa getNearbyNodesOf
39  *
40  * ### Specifications
41  *
42  * - Map type: 2D
43  * - MRPT rawlog format: #1, #2
44  * - Graph Type: CPosePDFGaussianInf
45  * - Observations: CObservation2DRangeScan, CObservation3DRangeScan
46  * - Edge Registration Strategy: ICP Goodnesss threshold
47  *
48  * ### .ini Configuration Parameters
49  *
50  * \htmlinclude graphslam-engine_config_params_preamble.txt
51  *
52  * - \b class_verbosity
53  * + \a Section : EdgeRegistrationDeciderParameters
54  * + \a default value : 1 (mrpt::system::LVL_INFO)
55  * + \a Required : FALSE
56  *
57  * - \b LC_min_nodeid_diff
58  * + \a Section : GeneralConfiguration
59  * + \a Default value : 30
60  * + \a Required : FALSE
61  * + \a Description : Minimum NodeID difference for an edge to be considered
62  * a loop closure.
63  *
64  * - \b ICP_max_distance
65  * + \a Section : EdgeRegistrationDeciderParameters
66  * + \a Default value : 10 // meters
67  * + \a Required : FALSE
68  * + \a Description : Maximum distance for scan-matching. Decider tries to
69  * align the laser scans of the current node and each of the previous nodes
70  * that are found within the designated ICP_max_distance.
71  *
72  * - \b ICP_goodness_thresh
73  * + \a Section : EdgeRegistrationDeciderParameters
74  * + \a Default value : 0.75
75  * + \a Required : FALSE
76  * + \a Description : Threshold for accepting a scan-matching edge between
77  * the current and previous nodes
78  *
79  * - \b visualize_laser_scans
80  * + \a Section : VisualizationParameters
81  * + \a Default value : TRUE
82  * + \a Required : FALSE
83  *
84  * - \b scans_img_external_dir
85  * + \a Section : EdgeRegistrationDeciderParameters
86  * + \a Default value : . (current directory)
87  * + \a Required : FALSE
88  * + \a Description : Only applicable in datasets with 3DRangeScans that
89  * are externally stored (not stored in the given .rawlog file).
90  *
91  * \ingroup mrpt_graphslam_grp
92  */
93 template <class GRAPH_T = typename mrpt::graphs::CNetworkOfPoses2DInf>
96  GRAPH_T>
97 {
98  public:
99  /**\brief Handy typedefs */
100  /**\{*/
101  /**\brief type of graph constraints */
102  using constraint_t = typename GRAPH_T::constraint_t;
103  /**\brief type of underlying poses (2D/3D). */
104  using pose_t = typename GRAPH_T::constraint_t::type_value;
107  /** self type - Handy type */
110  /**\}*/
111 
112  // Public methods
113  //////////////////////////////////////////////////////////////
114  CICPCriteriaERD();
116 
117  bool updateState(
119  mrpt::obs::CSensoryFrame::Ptr observations,
120  mrpt::obs::CObservation::Ptr observation);
121 
123  const std::map<std::string, bool>& events_occurred);
124  void getEdgesStats(std::map<std::string, int>* edge_types_to_num) const;
125 
126  void initializeVisuals();
127  void updateVisuals();
128  void loadParams(const std::string& source_fname);
129  void printParams() const;
130 
132  {
133  public:
134  TParams(decider_t& d);
135  ~TParams();
136 
137  void loadFromConfigFile(
139  const std::string& section);
140  void dumpToTextStream(std::ostream& out) const;
141 
143  // maximum distance for checking other nodes for ICP constraints
145  // threshold for accepting an ICP constraint in the graph
149  // keystroke to be used for the user to toggle the LaserScans from
150  // the CDisplayWindow
152 
154 
156  };
157  void getDescriptiveReport(std::string* report_str) const;
158 
159  // Public variables
160  // ////////////////////////////
162 
163  protected:
164  // protected functions
165  //////////////////////////////////////////////////////////////
167  const std::set<mrpt::graphs::TNodeID>& nodes_set);
169  const std::set<mrpt::graphs::TNodeID>& nodes_set);
170  void registerNewEdge(
171  const mrpt::graphs::TNodeID& from, const mrpt::graphs::TNodeID& to,
172  const constraint_t& rel_edge);
175  mrpt::obs::CSensoryFrame::Ptr observations,
176  mrpt::obs::CObservation::Ptr observation);
177  /**\brief Get a list of the nodeIDs whose position is within a certain
178  * distance to the specified nodeID
179  */
180  void getNearbyNodesOf(
181  std::set<mrpt::graphs::TNodeID>* nodes_set,
182  const mrpt::graphs::TNodeID& cur_nodeID, double distance);
183  /**\brief togle the LaserScans visualization on and off
184  */
187  std::string viz_flag, int sleep_time = 500 /* ms */);
188 
189  // protected variables
190  //////////////////////////////////////////////////////////////
191 
192  /** see Constructor for initialization */
194  /** see Constructor for initialization */
198 
199  std::map<mrpt::graphs::TNodeID, mrpt::obs::CObservation2DRangeScan::Ptr>
201  std::map<mrpt::graphs::TNodeID, mrpt::obs::CObservation3DRangeScan::Ptr>
203  std::map<std::string, int> m_edge_types_to_nums;
205 
208  // fake 2D laser scan generated from corresponding 3DRangeScan for
209  // visualization reasons
211 };
212 }
213 #include "CICPCriteriaERD_impl.h"
214 #endif /* end of include guard: CICPCRITERIAERD_H */
215 
216 
mrpt::img::TColor m_search_disk_color
see Constructor for initialization
typename parent_t::range_ops_t range_ops_t
void checkRegistrationCondition2D(const std::set< mrpt::graphs::TNodeID > &nodes_set)
typename GRAPH_T::constraint_t::type_value pose_t
type of underlying poses (2D/3D).
void dumpToTextStream(std::ostream &out) const
This method should clearly display all the contents of the structure in textual form, sending it to a std::ostream.
This is a virtual base class for sets of options than can be loaded from and/or saved to configuratio...
mrpt::img::TColor m_laser_scans_color
see Constructor for initialization
void notifyOfWindowEvents(const std::map< std::string, bool > &events_occurred)
Get a list of the window events that happened since the last call.
void dumpVisibilityErrorMsg(std::string viz_flag, int sleep_time=500)
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...
mrpt::obs::CObservation2DRangeScan::Ptr m_last_laser_scan2D
Edge Registration Decider Interface from which RangeScanner-based ERDs can inherit from...
mrpt::obs::CObservation3DRangeScan::Ptr m_last_laser_scan3D
void toggleLaserScansVisualization()
togle the LaserScans visualization on and off
This class allows loading and storing values and vectors of different types from a configuration text...
void registerNewEdge(const mrpt::graphs::TNodeID &from, const mrpt::graphs::TNodeID &to, const constraint_t &rel_edge)
Register a new constraint/edge in the current graph.
std::map< mrpt::graphs::TNodeID, mrpt::obs::CObservation2DRangeScan::Ptr > m_nodes_to_laser_scans2D
void getDescriptiveReport(std::string *report_str) const
Fill the provided string with a detailed report of the decider/optimizer state.
void checkRegistrationCondition3D(const std::set< mrpt::graphs::TNodeID > &nodes_set)
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.
void checkIfInvalidDataset(mrpt::obs::CActionCollection::Ptr action, mrpt::obs::CSensoryFrame::Ptr observations, mrpt::obs::CObservation::Ptr observation)
GLsizei const GLchar ** string
Definition: glext.h:4101
std::map< std::string, int > m_edge_types_to_nums
void printParams() const
Print the problem parameters - relevant to the decider/optimizer to the screen in a unified/compact w...
GLsizei GLsizei GLchar * source
Definition: glext.h:4082
mrpt::obs::CObservation2DRangeScan::Ptr m_fake_laser_scan2D
uint64_t TNodeID
A generic numeric type for unique IDs of nodes or entities.
Definition: TNodeID.h:16
mrpt::graphslam::deciders::CRangeScanOps< GRAPH_T > range_ops_t
Typedef for accessing methods of the RangeScanRegistrationDecider_t parent class. ...
std::map< mrpt::graphs::TNodeID, mrpt::obs::CObservation3DRangeScan::Ptr > m_nodes_to_laser_scans3D
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...
A RGB color - 8bit.
Definition: TColor.h:20
void updateVisuals()
Update the relevant visual features in CDisplayWindow.
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...
double distance(const TPoint2D &p1, const TPoint2D &p2)
Gets the distance between two points in a 2D space.
Definition: geometry.cpp:1891
typename parent_t::nodes_to_scans2D_t nodes_to_scans2D_t
void loadParams(const std::string &source_fname)
Fetch the latest observation that the current instance received (most probably during a call to the u...
std::map< mrpt::graphs::TNodeID, mrpt::obs::CObservation2DRangeScan::Ptr > nodes_to_scans2D_t
typename GRAPH_T::constraint_t constraint_t
Handy typedefs.
void initializeVisuals()
Initialize visual objects in CDisplayWindow (e.g.



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020