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-2017, 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 
13 #include <mrpt/math/CMatrix.h>
14 #include <mrpt/math/utils.h>
15 #include <mrpt/utils/CImage.h>
17 #include <mrpt/utils/CConfigFile.h>
19 #include <mrpt/utils/CTimeLogger.h>
20 #include <mrpt/utils/CStream.h>
22 #include <mrpt/utils/TColor.h>
26 #include <mrpt/obs/CSensoryFrame.h>
27 #include <mrpt/obs/CRawlog.h>
28 #include <mrpt/opengl/CDisk.h>
31 #include <mrpt/slam/CICP.h>
32 #include <mrpt/system/os.h>
33 #include <mrpt/system/filesystem.h>
34 
35 #include <stdlib.h> // abs
36 
37 #include <iostream>
38 #include <map>
39 #include <string>
40 
42 
43 namespace mrpt
44 {
45 namespace graphslam
46 {
47 namespace deciders
48 {
49 /**\brief ICP-based Edge Registration.
50  *
51  * ## Description
52  *
53  * Register new edges in the graph with the last inserted node. Criterion for
54  * adding new edges should be the goodness of the candidate ICP edge. The
55  * nodes for ICP are picked <em>based on the distance from the last
56  * inserted node</em>.
57  * \sa getNearbyNodesOf
58  *
59  * ### Specifications
60  *
61  * - Map type: 2D
62  * - MRPT rawlog format: #1, #2
63  * - Graph Type: CPosePDFGaussianInf
64  * - Observations: CObservation2DRangeScan, CObservation3DRangeScan
65  * - Edge Registration Strategy: ICP Goodnesss threshold
66  *
67  * ### .ini Configuration Parameters
68  *
69  * \htmlinclude graphslam-engine_config_params_preamble.txt
70  *
71  * - \b class_verbosity
72  * + \a Section : EdgeRegistrationDeciderParameters
73  * + \a default value : 1 (LVL_INFO)
74  * + \a Required : FALSE
75  *
76  * - \b LC_min_nodeid_diff
77  * + \a Section : GeneralConfiguration
78  * + \a Default value : 30
79  * + \a Required : FALSE
80  * + \a Description : Minimum NodeID difference for an edge to be considered
81  * a loop closure.
82  *
83  * - \b ICP_max_distance
84  * + \a Section : EdgeRegistrationDeciderParameters
85  * + \a Default value : 10 // meters
86  * + \a Required : FALSE
87  * + \a Description : Maximum distance for scan-matching. Decider tries to
88  * align the laser scans of the current node and each of the previous nodes
89  * that are found within the designated ICP_max_distance.
90  *
91  * - \b ICP_goodness_thresh
92  * + \a Section : EdgeRegistrationDeciderParameters
93  * + \a Default value : 0.75
94  * + \a Required : FALSE
95  * + \a Description : Threshold for accepting a scan-matching edge between
96  * the current and previous nodes
97  *
98  * - \b visualize_laser_scans
99  * + \a Section : VisualizationParameters
100  * + \a Default value : TRUE
101  * + \a Required : FALSE
102  *
103  * - \b scans_img_external_dir
104  * + \a Section : EdgeRegistrationDeciderParameters
105  * + \a Default value : . (current directory)
106  * + \a Required : FALSE
107  * + \a Description : Only applicable in datasets with 3DRangeScans that
108  * are externally stored (not stored in the given .rawlog file).
109  *
110  * \ingroup mrpt_graphslam_grp
111  */
112 template <class GRAPH_T = typename mrpt::graphs::CNetworkOfPoses2DInf>
115  GRAPH_T>
116 {
117  public:
118  /**\brief Handy typedefs */
119  /**\{*/
120  /**\brief type of graph constraints */
121  typedef typename GRAPH_T::constraint_t constraint_t;
122  /**\brief type of underlying poses (2D/3D). */
123  typedef typename GRAPH_T::constraint_t::type_value pose_t;
127  decider_t; /**< self type - Handy typedef */
129  /**\}*/
130 
131  // Public methods
132  //////////////////////////////////////////////////////////////
133  CICPCriteriaERD();
135 
136  bool updateState(
138  mrpt::obs::CSensoryFrame::Ptr observations,
139  mrpt::obs::CObservation::Ptr observation);
140 
142  const std::map<std::string, bool>& events_occurred);
143  void getEdgesStats(std::map<std::string, int>* edge_types_to_num) const;
144 
145  void initializeVisuals();
146  void updateVisuals();
147  void loadParams(const std::string& source_fname);
148  void printParams() const;
149 
151  {
152  public:
153  TParams(decider_t& d);
154  ~TParams();
155 
156  void loadFromConfigFile(
158  const std::string& section);
159  void dumpToTextStream(mrpt::utils::CStream& out) const;
160 
162  // maximum distance for checking other nodes for ICP constraints
164  // threshold for accepting an ICP constraint in the graph
168  // keystroke to be used for the user to toggle the LaserScans from
169  // the CDisplayWindow
171 
173 
175  };
176  void getDescriptiveReport(std::string* report_str) const;
177 
178  // Public variables
179  // ////////////////////////////
181 
182  protected:
183  // protected functions
184  //////////////////////////////////////////////////////////////
186  const std::set<mrpt::utils::TNodeID>& nodes_set);
188  const std::set<mrpt::utils::TNodeID>& nodes_set);
189  void registerNewEdge(
190  const mrpt::utils::TNodeID& from, const mrpt::utils::TNodeID& to,
191  const constraint_t& rel_edge);
194  mrpt::obs::CSensoryFrame::Ptr observations,
195  mrpt::obs::CObservation::Ptr observation);
196  /**\brief Get a list of the nodeIDs whose position is within a certain
197  * distance to the specified nodeID
198  */
199  void getNearbyNodesOf(
200  std::set<mrpt::utils::TNodeID>* nodes_set,
201  const mrpt::utils::TNodeID& cur_nodeID, double distance);
202  /**\brief togle the LaserScans visualization on and off
203  */
206  std::string viz_flag, int sleep_time = 500 /* ms */);
207 
208  // protected variables
209  //////////////////////////////////////////////////////////////
210 
211  /** see Constructor for initialization */
213  /** see Constructor for initialization */
217 
218  std::map<mrpt::utils::TNodeID, mrpt::obs::CObservation2DRangeScan::Ptr>
220  std::map<mrpt::utils::TNodeID, mrpt::obs::CObservation3DRangeScan::Ptr>
222  std::map<std::string, int> m_edge_types_to_nums;
224 
227  // fake 2D laser scan generated from corresponding 3DRangeScan for
228  // visualization reasons
230 };
231 }
232 }
233 } // end of namespaces
234 
235 #include "CICPCriteriaERD_impl.h"
236 #endif /* end of include guard: CICPCRITERIAERD_H */
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)
void checkRegistrationCondition2D(const std::set< mrpt::utils::TNodeID > &nodes_set)
GRAPH_T::constraint_t constraint_t
Handy typedefs.
std::shared_ptr< CObservation3DRangeScan > Ptr
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
mrpt::utils::TColor m_search_disk_color
see Constructor for initialization
Edge Registration Decider Interface from which RangeScanner-based ERDs can inherit from...
std::shared_ptr< CObservation2DRangeScan > Ptr
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...
std::map< mrpt::utils::TNodeID, mrpt::obs::CObservation2DRangeScan::Ptr > nodes_to_scans2D_t
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:41
std::map< mrpt::utils::TNodeID, mrpt::obs::CObservation2DRangeScan::Ptr > m_nodes_to_laser_scans2D
uint64_t TNodeID
The type for node IDs in graphs of different types.
void getDescriptiveReport(std::string *report_str) const
Fill the provided string with a detailed report of the decider/optimizer state.
A RGB color - 8bit.
Definition: TColor.h:25
std::shared_ptr< CSensoryFrame > Ptr
Definition: CSensoryFrame.h:56
void checkIfInvalidDataset(mrpt::obs::CActionCollection::Ptr action, mrpt::obs::CSensoryFrame::Ptr observations, mrpt::obs::CObservation::Ptr observation)
std::shared_ptr< CObservation > Ptr
Definition: CObservation.h:43
GLsizei const GLchar ** string
Definition: glext.h:4101
void dumpToTextStream(mrpt::utils::CStream &out) const
This method should clearly display all the contents of the structure in textual form, sending it to a CStream.
mrpt::utils::TColor m_laser_scans_color
see Constructor for initialization
Class for keeping together all the RangeScanner-related functions.
Definition: CRangeScanOps.h:85
std::map< std::string, int > m_edge_types_to_nums
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void registerNewEdge(const mrpt::utils::TNodeID &from, const mrpt::utils::TNodeID &to, const constraint_t &rel_edge)
Register a new constraint/edge in the current graph.
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source, const std::string &section)
This method load the options from a ".ini"-like file or memory-stored string list.
CRangeScanEdgeRegistrationDecider< GRAPH_T > parent_t
std::shared_ptr< CActionCollection > Ptr
parent_t::nodes_to_scans2D_t nodes_to_scans2D_t
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
void getNearbyNodesOf(std::set< mrpt::utils::TNodeID > *nodes_set, const mrpt::utils::TNodeID &cur_nodeID, double distance)
Get a list of the nodeIDs whose position is within a certain distance to the specified nodeID...
mrpt::obs::CObservation2DRangeScan::Ptr m_fake_laser_scan2D
CICPCriteriaERD< GRAPH_T > decider_t
self type - Handy typedef
GRAPH_T::constraint_t::type_value pose_t
type of underlying poses (2D/3D).
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...
std::map< mrpt::utils::TNodeID, mrpt::obs::CObservation3DRangeScan::Ptr > m_nodes_to_laser_scans3D
double distance(const TPoint2D &p1, const TPoint2D &p2)
Gets the distance between two points in a 2D space.
Definition: geometry.cpp:1885
This is a virtual base class for sets of options than can be loaded from and/or saved to configuratio...
void loadParams(const std::string &source_fname)
Fetch the latest observation that the current instance received (most probably during a call to the u...
void initializeVisuals()
Initialize visual objects in CDisplayWindow (e.g.
void checkRegistrationCondition3D(const std::set< mrpt::utils::TNodeID > &nodes_set)



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019