10 #ifndef CICPCRITERIANRD_IMPL_H 11 #define CICPCRITERIANRD_IMPL_H 22 template <
class GRAPH_T>
43 this->logFmt(LVL_DEBUG,
"Initialized class object");
45 template <
class GRAPH_T>
50 template <
class GRAPH_T>
63 bool registered_new_node =
false;
97 if (action->getBestMovementEstimation())
102 action->getBestMovementEstimation();
105 increment_gaussian.
copyFrom(*increment);
125 return registered_new_node;
130 template <
class GRAPH_T>
135 bool registered_new_node =
false;
149 return registered_new_node;
153 template <
class GRAPH_T>
161 bool registered_new_node =
false;
174 ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
176 LVL_DEBUG,
"ICP Alignment operation:\tnIterations: %d\tgoodness: %.f\n",
180 LVL_DEBUG,
"Current ICP constraint: \n\tEdge: %s\n\tNorm: %f",
181 rel_edge.getMeanVal().asString().c_str(), rel_edge.getMeanVal().norm());
184 "Corresponding Odometry constraint: \n\tEdge: %s\n\tNorm: %f",
190 double mahal_distance =
201 double mahal_distance_lim = 0.18;
208 if (mahal_distance < mahal_distance_lim ||
211 this->logFmt(LVL_DEBUG,
"Using ICP Edge");
216 this->logFmt(LVL_DEBUG,
"Using Odometry Edge");
220 this->logFmt(LVL_DEBUG,
"\tMahalanobis Distance = %f", mahal_distance);
236 "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
237 return registered_new_node;
241 template <
class GRAPH_T>
249 template <
class GRAPH_T>
256 template <
class GRAPH_T>
261 this->logFmt(LVL_DEBUG,
"In checkRegistrationCondition");
268 bool angle_crit =
false;
273 params.registration_max_angle;
275 bool distance_crit =
false;
279 params.registration_max_distance;
283 bool registered =
false;
284 if (distance_crit || angle_crit)
293 template <
class GRAPH_T>
301 params.loadFromConfigFileName(
302 source_fname,
"NodeRegistrationDeciderParameters");
309 int min_verbosity_level =
source.read_int(
310 "NodeRegistrationDeciderParameters",
"class_verbosity", 1,
false);
311 this->setMinLoggingLevel(VerbosityLevel(min_verbosity_level));
312 this->logFmt(LVL_DEBUG,
"Successfully loaded parameters.");
316 template <
class GRAPH_T>
328 template <
class GRAPH_T>
339 stringstream class_props_ss;
340 class_props_ss <<
"ICP Goodness-based Registration Procedure Summary: " 346 const std::string output_res = this->getLogAsString();
352 *report_str += class_props_ss.str();
356 *report_str += time_res;
359 *report_str += output_res;
367 template <
class GRAPH_T>
371 template <
class GRAPH_T>
375 template <
class GRAPH_T>
385 "------------------[ ICP Fixed Intervals Node Registration " 386 "]------------------\n");
388 "Max distance for registration = %.2f m\n", registration_max_distance);
390 "Max Angle for registration = %.2f deg\n",
391 RAD2DEG(registration_max_angle));
393 decider.range_ops_t::params.dumpToTextStream(out);
397 template <
class GRAPH_T>
406 registration_max_distance =
source.read_double(
407 section,
"registration_max_distance", 0.5 ,
false);
408 registration_max_angle =
source.read_double(
409 section,
"registration_max_angle", 10 ,
false);
410 registration_max_angle =
DEG2RAD(registration_max_angle);
413 decider.range_ops_t::params.loadFromConfigFile(
source,
"ICP");
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.
mrpt::obs::CObservation2DRangeScan::Ptr m_last_laser_scan2D
handy laser scans to use in the class methods
virtual void loadParams(const std::string &source_fname)
Load the necessary for the decider/optimizer configuration parameters.
bool updateState2D(mrpt::obs::CObservation2DRangeScan::Ptr observation)
Specialized updateState method used solely when dealing with 2DRangeScan information.
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.
void getICPEdge(const mrpt::obs::CObservation2DRangeScan &from, const mrpt::obs::CObservation2DRangeScan &to, constraint_t *rel_edge, const mrpt::poses::CPose2D *initial_pose=nullptr, mrpt::slam::CICP::TReturnInfo *icp_info=nullptr)
Align the 2D range scans provided and fill the potential edge that can transform the one into the oth...
#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.
mrpt::obs::CObservation2DRangeScan::Ptr m_curr_laser_scan2D
Current LaserScan.
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.
std::shared_ptr< CObservation3DRangeScan > Ptr
virtual void getDescriptiveReport(std::string *report_str) const
Fill the provided string with a detailed report of the decider/optimizer state.
std::shared_ptr< CObservation2DRangeScan > Ptr
std::shared_ptr< CObservationOdometry > Ptr
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.
std::shared_ptr< CPosePDF > Ptr
void copyFrom(const CPosePDF &o) override
Copy operator, translating if necesary (for example, between particles and gaussian representations) ...
std::shared_ptr< CActionRobotMovement2D > Ptr
#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.
std::shared_ptr< CSensoryFrame > Ptr
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...
std::shared_ptr< CObservation > Ptr
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 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...
std::shared_ptr< CActionCollection > Ptr
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...
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.
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.
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.
bool updateState3D(mrpt::obs::CObservation3DRangeScan::Ptr observation)
Specialized updateState method used solely when dealing with 3DRangeScan information.
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...