Main MRPT website > C++ reference for MRPT 1.9.9
CICPCriteriaNRD.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 CICPCRITERIANRD_H
11 #define CICPCRITERIANRD_H
12 
13 #include <mrpt/obs/CRawlog.h>
15 #include <mrpt/obs/CSensoryFrame.h>
18 #include <mrpt/poses/CPosePDF.h>
19 #include <mrpt/poses/CPose3DPDF.h>
22 #include <mrpt/obs/CRawlog.h>
26 #include <mrpt/utils/CConfigFile.h>
28 #include <mrpt/utils/CStream.h>
30 #include <mrpt/slam/CICP.h>
31 #include <mrpt/system/datetime.h>
32 #include <mrpt/system/os.h>
33 
37 
38 #include <string>
39 #include <math.h>
40 
41 namespace mrpt
42 {
43 namespace graphslam
44 {
45 namespace deciders
46 {
47 /**\brief ICP-based Fixed Intervals Node Registration
48  *
49  * ## Description
50  *
51  * Current Decider is meant for adding nodes in 2D datasets recorded using
52  * a laser range finder or RGB-D camera (e.g. Kinect). No odometry data from
53  * encoders is needed. Using ICP to match consecutive RangeScan measurements,
54  * the decider keeps track of the pose transformation since the last registered
55  * node. If the norm or the angle of the latter surpasses certain thresholds
56  * (which are read from an external .ini file) then a new node is added to the
57  * graph)
58  * \sa loadParams, TParams::loadFromConfigFile
59  *
60  * Decider *does not guarantee* thread safety when accessing the GRAPH_T
61  * resource. This is handled by the CGraphSlamEngine class.
62  *
63  * ### Specifications
64  *
65  * - Map type: 2D
66  * - MRPT rawlog format: #1, #2
67  * - Graph Type: CPosePDFGaussianInf
68  * - Observations Used: CObservation2DRangeScan, CObservation3DRangeScan
69  * - Node Registration Strategy: Fixed Intervals
70  *
71  * ### .ini Configuration Parameters
72  *
73  * \htmlinclude config_params_preamble.txt
74  *
75  * - \b class_verbosity
76  * + \a Section : NodeRegistrationDeciderParameters
77  * + \a default value : 1 (LVL_INFO)
78  * + \a Required : FALSE
79  *
80  * - \b registration_max_distance
81  * + \a Section : NodeRegistrationDeciderParameters
82  * + \a Default value : 0.5 // meters
83  * + \a Required : FALSE
84  *
85  * - \b registration_max_angle
86  * + \a Section : NodeRegistrationDeciderParameters
87  * + \a Default value : 10 // degrees
88  * + \a Required : FALSE
89  *
90  * \note Since the decider inherits from the CRangeScanOps
91  * class, it parses the configuration parameters of the latter as well from the
92  * "ICP" section. Refer to the CRangeScanOps documentation for
93  * its list of configuration
94  * parameters
95  *
96  * \note Class contains an instance of the TSlidingWindow class and it parses
97  * the configuration parameters of the latter from the
98  * "NodeRegistrationDeciderParameters" section. Refer to TSlidingWindow
99  * documentation for its list of configuration parameters
100  *
101  * \ingroup mrpt_graphslam_grp
102  */
103 template <class GRAPH_T>
106  GRAPH_T>,
108 {
109  public:
110  // Public functions
111  //////////////////////////////////////////////////////////////
112  /**\brief Handy typedefs */
113  /**\{*/
114  /**\brief type of graph constraints */
115  typedef typename GRAPH_T::constraint_t constraint_t;
116  /**\brief type of underlying poses (2D/3D). */
117  typedef typename GRAPH_T::constraint_t::type_value pose_t;
118  typedef typename GRAPH_T::global_pose_t global_pose_t;
119 
120  typedef mrpt::math::CMatrixFixedNumeric<double, constraint_t::state_length,
121  constraint_t::state_length>
123  /**\brief Typedef for accessing methods of the RangeScanRegistrationDecider
124  * parent class.
125  */
128  decider_t; /**< self type - Handy typedef */
129  /**\brief Node Registration Decider */
132  /**\}*/
133 
134  /**\brief Class constructor */
135  CICPCriteriaNRD();
136  /**\brief Class destructor */
138 
139  void loadParams(const std::string& source_fname);
140  void printParams() const;
141  void getDescriptiveReport(std::string* report_str) const;
142 
143  /**\brief Update the decider state using the latest dataset measurements.
144  *
145  * \note Depending on the observations at hand, update of the state is
146  * handled either by updateState2D, or by updateState3D methods. This
147  * helps in separating the 2D, 3D RangeScans handling altogether, which in
148  * turn simplifies the overall procedure
149  *
150  * Order of calls:
151  * updateState (calls) ==> updateState2D/3D ==>
152  * checkRegistrationCondition2D/3D ==> CheckRegistrationCondition
153  *
154  * \sa updateState2D, updateState3D
155  */
156  bool updateState(
158  mrpt::obs::CSensoryFrame::Ptr observations,
159  mrpt::obs::CObservation::Ptr observation);
160  /**\brief Specialized updateState method used solely when dealing with
161  * 2DRangeScan information.
162  * \sa updateState3D
163  */
165  /**\brief Specialized updateState method used solely when dealing with
166  * 3DRangeScan information.
167  * \sa updateState2D
168  */
170 
172  {
173  public:
174  TParams(decider_t& d);
175  ~TParams();
176 
177  decider_t& decider; /**< Reference to outer decider class */
178 
179  void loadFromConfigFile(
181  const std::string& section);
182  void dumpToTextStream(mrpt::utils::CStream& out) const;
183 
184  double registration_max_distance; /**< Maximum distance for new node
185  registration */
186  double registration_max_angle; /**< Maximum angle difference for new
187  node registration */
188  };
189 
190  // Public members
191  // ////////////////////////////
193 
194  protected:
195  // protected functions
196  //////////////////////////////////////////////////////////////
198  /**\brief Specialized checkRegistrationCondtion method used solely when
199  * dealing with 2DRangeScan information
200  * \sa checkRegistrationCondition3D
201  */
203  /**\brief Specialized checkRegistrationCondition method used solely when
204  * dealing with 3DRangeScan information
205  * \sa checkRegistrationCondition2D
206  */
208 
209  // protected members
210  //////////////////////////////////////////////////////////////
212 
213  /**\brief handy laser scans to use in the class methods
214  */
215  /**\{ */
216  /**\brief 2D LaserScan corresponding to the latest registered node in the
217  * graph */
219  /**\brief Current LaserScan. Set during the new measurements acquisition in
220  * updateState method
221  */
223 
226  /**\} */
227 
228  /**\brief Odometry rigid-body transformation since the last accepted
229  * LaserScan.
230  *
231  * Decider can use it to smoothen the trajectory in the case of high noise
232  * in the laser measurements
233  */
235  /**\brief pose_t estimation using only odometry information.
236  * \note Utilized only in observation-only rawlogs.
237  *
238  */
240  /**\brief pose_t estimation using only odometry information.
241  * \note Utilized only in observation-only rawlogs.
242  *
243  * Resets next time an ICP edge/Odometry measurement is utilized for
244  * updating the estimated robot position.
245  */
247  /**\brief Keeps track of the last N measurements between the ICP edge and
248  * the corresponding odometry measurements.
249  *
250  * Use the last odometry rigid body transformation instead of the
251  * ICP edge if the mahalanobis distance between them is greater than this
252  * limit.
253  */
255 
256  // criteria for adding new a new node
259 
260  /**How many times we used the ICP Edge instead of Odometry edge*/
262  /**How many times we used the Odometry Edge instead of the ICP edge */
264 };
265 }
266 }
267 } // end of namespaces
268 
269 #include "CICPCriteriaNRD_impl.h"
270 #endif /* end of include guard: CICPCRITERIANRD_H */
int m_times_used_ICP
How many times we used the ICP Edge instead of Odometry edge.
void getDescriptiveReport(std::string *report_str) const
Fill the provided string with a detailed report of the decider/optimizer state.
GRAPH_T::constraint_t::type_value pose_t
type of underlying poses (2D/3D).
mrpt::graphslam::deciders::CRangeScanOps< GRAPH_T > range_ops_t
Typedef for accessing methods of the RangeScanRegistrationDecider parent class.
mrpt::obs::CObservation2DRangeScan::Ptr m_last_laser_scan2D
handy laser scans to use in the class methods
decider_t & decider
Reference to outer decider class.
bool updateState2D(mrpt::obs::CObservation2DRangeScan::Ptr observation)
Specialized updateState method used solely when dealing with 2DRangeScan information.
Interface for implementing node registration classes.
pose_t m_curr_odometry_only_pose
pose_t estimation using only odometry information.
pose_t m_last_odometry_only_pose
pose_t estimation using only odometry information.
mrpt::obs::CObservation2DRangeScan::Ptr m_curr_laser_scan2D
Current LaserScan.
ICP-based Fixed Intervals Node Registration.
std::shared_ptr< CObservation3DRangeScan > Ptr
std::shared_ptr< CObservation2DRangeScan > Ptr
double registration_max_distance
Maximum distance for new node registration.
This class allows loading and storing values and vectors of different types from a configuration text...
CICPCriteriaNRD< GRAPH_T > decider_t
self type - Handy typedef
bool checkRegistrationCondition()
Check whether a new node should be registered in the graph.
void printParams() const
Print the problem parameters - relevant to the decider/optimizer to the screen in a unified/compact w...
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:41
GRAPH_T::constraint_t constraint_t
type of graph constraints
A numeric matrix of compile-time fixed size.
double registration_max_angle
Maximum angle difference for new node registration.
mrpt::obs::CObservation3DRangeScan::Ptr m_curr_laser_scan3D
std::shared_ptr< CSensoryFrame > Ptr
Definition: CSensoryFrame.h:56
constraint_t m_latest_odometry_PDF
Odometry rigid-body transformation since the last accepted LaserScan.
std::shared_ptr< CObservation > Ptr
Definition: CObservation.h:43
TSlidingWindow m_mahal_distance_ICP_odom
Keeps track of the last N measurements between the ICP edge and the corresponding odometry measuremen...
GLsizei const GLchar ** string
Definition: glext.h:4101
mrpt::obs::CObservation3DRangeScan::Ptr m_last_laser_scan3D
Class for keeping together all the RangeScanner-related functions.
Definition: CRangeScanOps.h:85
GRAPH_T::constraint_t::type_value pose_t
type of underlying poses (2D/3D).
bool checkRegistrationCondition2D()
Specialized checkRegistrationCondtion method used solely when dealing with 2DRangeScan information...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
std::shared_ptr< CActionCollection > Ptr
mrpt::math::CMatrixFixedNumeric< double, constraint_t::state_length, constraint_t::state_length > InfMat
Class to monitor the evolution of a statistical quantity.
void loadParams(const std::string &source_fname)
Load the necessary for the decider/optimizer configuration parameters.
GLsizei GLsizei GLchar * source
Definition: glext.h:4082
bool checkRegistrationCondition3D()
Specialized checkRegistrationCondition method used solely when dealing with 3DRangeScan information...
mrpt::graphslam::deciders::CNodeRegistrationDecider< GRAPH_T > parent_t
Node Registration Decider.
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.
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.
GRAPH_T::constraint_t constraint_t
Handy typedefs.
bool updateState(mrpt::obs::CActionCollection::Ptr action, mrpt::obs::CSensoryFrame::Ptr observations, mrpt::obs::CObservation::Ptr observation)
Update the decider state using the latest dataset measurements.
int m_times_used_odom
How many times we used the Odometry Edge instead of the ICP edge.
This is a virtual base class for sets of options than can be loaded from and/or saved to configuratio...
bool updateState3D(mrpt::obs::CObservation3DRangeScan::Ptr observation)
Specialized updateState method used solely when dealing with 3DRangeScan information.



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