10 #ifndef CICPCRITERIANRD_IMPL_H 11 #define CICPCRITERIANRD_IMPL_H 13 namespace mrpt {
namespace graphslam {
namespace deciders {
18 template<
class GRAPH_T>
38 this->logFmt(LVL_DEBUG,
"Initialized class object");
40 template<
class GRAPH_T>
44 template<
class GRAPH_T>
46 mrpt::obs::CActionCollectionPtr action,
47 mrpt::obs::CSensoryFramePtr observations,
48 mrpt::obs::CObservationPtr observation ) {
56 bool registered_new_node =
false;
58 if (observation.present()) {
61 mrpt::obs::CObservation2DRangeScanPtr curr_laser_scan =
62 static_cast<CObservation2DRangeScanPtr
>(observation);
67 CObservation3DRangeScanPtr curr_laser_scan =
68 static_cast<CObservation3DRangeScanPtr
>(observation);
74 CObservationOdometryPtr obs_odometry =
75 static_cast<CObservationOdometryPtr
>(observation);
88 if (action->getBestMovementEstimation()) {
90 CActionRobotMovement2DPtr robot_move =
91 action->getBestMovementEstimation();
92 CPosePDFPtr increment = robot_move->poseChange.get_ptr();
94 increment_gaussian.
copyFrom(*increment);
100 CObservation2DRangeScanPtr curr_laser_scan =
105 CObservation3DRangeScanPtr curr_laser_scan =
113 return registered_new_node;
118 template<
class GRAPH_T>
120 mrpt::obs::CObservation2DRangeScanPtr scan2d) {
122 bool registered_new_node =
false;
134 return registered_new_node;
138 template<
class GRAPH_T>
145 bool registered_new_node =
false;
159 this->logFmt(LVL_DEBUG,
160 ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
161 this->logFmt(LVL_DEBUG,
162 "ICP Alignment operation:\tnIterations: %d\tgoodness: %.f\n",
165 this->logFmt(LVL_DEBUG,
"Current ICP constraint: \n\tEdge: %s\n\tNorm: %f",
166 rel_edge.getMeanVal().asString().c_str(),
167 rel_edge.getMeanVal().norm());
168 this->logFmt(LVL_DEBUG,
"Corresponding Odometry constraint: \n\tEdge: %s\n\tNorm: %f",
183 double mahal_distance_lim = 0.18;
190 if (mahal_distance < mahal_distance_lim ||
192 this->logFmt(LVL_DEBUG,
"Using ICP Edge");
196 this->logFmt(LVL_DEBUG,
"Using Odometry Edge");
200 this->logFmt(LVL_DEBUG,
"\tMahalanobis Distance = %f", mahal_distance);
201 this->logFmt(LVL_DEBUG,
"Times that the ICP Edge was used: %d/%d",
213 this->logFmt(LVL_DEBUG,
214 "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
215 return registered_new_node;
219 template<
class GRAPH_T>
221 mrpt::obs::CObservation3DRangeScanPtr scan3d) {
226 template<
class GRAPH_T>
233 template<
class GRAPH_T>
237 this->logFmt(LVL_DEBUG,
"In checkRegistrationCondition");
244 bool angle_crit =
false;
247 params.registration_max_angle;
249 bool distance_crit =
false;
253 params.registration_max_distance; }
256 bool registered =
false;
257 if (distance_crit || angle_crit) {
265 template<
class GRAPH_T>
272 params.loadFromConfigFileName(source_fname,
273 "NodeRegistrationDeciderParameters");
280 int min_verbosity_level =
source.read_int(
281 "NodeRegistrationDeciderParameters",
284 this->setMinLoggingLevel(VerbosityLevel(min_verbosity_level));
285 this->logFmt(LVL_DEBUG,
"Successfully loaded parameters.");
289 template<
class GRAPH_T>
300 template<
class GRAPH_T>
310 stringstream class_props_ss;
311 class_props_ss <<
"ICP Goodness-based Registration Procedure Summary: " 317 const std::string output_res = this->getLogAsString();
323 *report_str += class_props_ss.str();
327 *report_str += time_res;
330 *report_str += output_res;
339 template<
class GRAPH_T>
343 template<
class GRAPH_T>
345 template<
class GRAPH_T>
354 "------------------[ ICP Fixed Intervals Node Registration ]------------------\n");
355 out.
printf(
"Max distance for registration = %.2f m\n",
356 registration_max_distance);
357 out.
printf(
"Max Angle for registration = %.2f deg\n",
358 RAD2DEG(registration_max_angle));
360 decider.range_ops_t::params.dumpToTextStream(out);
364 template<
class GRAPH_T>
373 registration_max_distance =
source.read_double( section,
374 "registration_max_distance",
376 registration_max_angle =
source.read_double( section,
377 "registration_max_angle",
379 registration_max_angle =
DEG2RAD(registration_max_angle);
382 decider.range_ops_t::params.loadFromConfigFile(
source,
"ICP");
bool updateState2D(mrpt::obs::CObservation2DRangeScanPtr observation)
Specialized updateState method used solely when dealing with 2DRangeScan information.
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.
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
bool updateState(mrpt::obs::CActionCollectionPtr action, mrpt::obs::CSensoryFramePtr observations, mrpt::obs::CObservationPtr observation)
Update the decider state using the latest dataset measurements.
virtual void loadParams(const std::string &source_fname)
Load the necessary for the decider/optimizer configuration parameters.
virtual void printParams() const
Print the problem parameters - relevant to the decider/optimizer to the screen in a unified/compact w...
This class allows loading and storing values and vectors of different types from ".ini" files easily.
#define THROW_EXCEPTION(msg)
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.
static const std::string header_sep
Separator string to be used in debugging messages.
Declares a class derived from "CObservation" that encapsules a 3D range scan measurement, as from a time-of-flight range camera or any other RGBD sensor.
ICP-based Fixed Intervals Node Registration.
virtual void getDescriptiveReport(std::string *report_str) const
Fill the provided string with a detailed report of the decider/optimizer state.
This class allows loading and storing values and vectors of different types from a configuration text...
bool registerNewNodeAtEnd()
Same goal as the previous method - uses the m_since_prev_node_PDF as the constraint at the end...
bool checkRegistrationCondition()
Check whether a new node should be registered in the graph.
float goodness
A goodness measure for the alignment, it is a [0,1] range indicator of percentage of correspondences...
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...
GRAPH_T::constraint_t constraint_t
type of graph constraints
This base provides a set of functions for maths stuff.
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
static const std::string report_sep
std::string getStatsAsText(const size_t column_width=80) const
Dump all stats to a multi-line text string.
CICPCriteriaNRD()
Class constructor.
This namespace contains representation of robot actions and observations.
void copyFrom(const CPosePDF &o) MRPT_OVERRIDE
Copy operator, translating if necesary (for example, between particles and gaussian representations) ...
bool m_use_distance_node_reg
constraint_t m_latest_odometry_PDF
Odometry rigid-body transformation since the last accepted LaserScan.
void resetPDF(constraint_t *c)
Reset the given PDF method and assign a fixed high-certainty Covariance/Information matrix...
virtual void initializeLoggers(const std::string &name)
Initialize the COutputLogger, CTimeLogger instances given the name of the decider/optimizer at hand...
unsigned short nIterations
The number of executed iterations until convergence.
GLsizei const GLchar ** string
T wrapToPi(T a)
Modifies the given angle to translate it into the ]-pi,pi] range.
bool m_use_angle_difference_node_reg
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
bool updateState3D(mrpt::obs::CObservation3DRangeScanPtr observation)
Specialized updateState method used solely when dealing with 3DRangeScan information.
void getICPEdge(const mrpt::obs::CObservation2DRangeScan &from, const mrpt::obs::CObservation2DRangeScan &to, constraint_t *rel_edge, const mrpt::poses::CPose2D *initial_pose=NULL, mrpt::slam::CICP::TReturnInfo *icp_info=NULL)
Align the 2D range scans provided and fill the potential edge that can transform the one into the oth...
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.
A Probability Density function (PDF) of a 2D pose as a Gaussian with a mean and the inverse of the c...
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
mrpt::utils::CTimeLogger m_time_logger
Time logger instance.
#define IS_CLASS(ptrObj, class_name)
Evaluates to true if the given pointer to an object (derived from mrpt::utils::CSerializable) is of t...
~CICPCriteriaNRD()
Class destructor.
The ICP algorithm return information.
void loadParams(const std::string &source_fname)
Load the necessary for the decider/optimizer configuration parameters.
GLsizei GLsizei GLchar * source
double leave(const char *func_name)
End of a named section.
bool checkRegistrationCondition3D()
Specialized checkRegistrationCondition method used solely when dealing with 3DRangeScan information...
mrpt::obs::CObservation2DRangeScanPtr m_last_laser_scan2D
handy laser scans to use in the class methods
An observation of the current (cumulative) odometry for a wheeled robot.
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 §ion)
This method load the options from a ".ini"-like file or memory-stored string list.
void enter(const char *func_name)
Start of a named section.
GLenum const GLfloat * params
int m_times_used_odom
How many times we used the Odometry Edge instead of the ICP edge.
virtual int printf(const char *fmt,...) MRPT_printf_format_check(2
Writes a string to the stream in a textual form.
mrpt::obs::CObservation2DRangeScanPtr m_curr_laser_scan2D
Current LaserScan.
constraint_t m_since_prev_node_PDF
Tracking the PDF of the current position of the robot with regards to the <b previous registered node...