10 #ifndef CFIXEDINTERVALSNRD_IMPL_H 11 #define CFIXEDINTERVALSNRD_IMPL_H 13 namespace mrpt {
namespace graphslam {
namespace deciders {
18 template<
class GRAPH_T>
21 this->initializeLoggers(
"CFixedIntervalsNRD");
23 this->logFmt(LVL_DEBUG,
"IntervalsNRD: Initialized class object");
25 template<
class GRAPH_T>
31 template<
class GRAPH_T>
33 mrpt::obs::CActionCollectionPtr action,
34 mrpt::obs::CSensoryFramePtr observations,
35 mrpt::obs::CObservationPtr observation ) {
45 if (observation.present()) {
46 m_observation_only_rawlog =
true;
50 CObservationOdometryPtr obs_odometry =
51 static_cast<CObservationOdometryPtr
>(observation);
53 m_curr_odometry_only_pose =
pose_t(obs_odometry->odometry);
54 this->logFmt(LVL_DEBUG,
"Current odometry-only pose: %s",
55 m_curr_odometry_only_pose.asString().c_str());
59 this->m_since_prev_node_PDF.mean =
60 m_curr_odometry_only_pose - m_last_odometry_only_pose;
64 m_observation_only_rawlog =
false;
67 bool found = action->getFirstMovementEstimation(move_pdf);
72 this->m_since_prev_node_PDF += incr_constraint;
76 bool registered = this->checkRegistrationCondition();
79 if (m_observation_only_rawlog) {
81 m_last_odometry_only_pose = m_curr_odometry_only_pose;
90 template<
class GRAPH_T>
96 this->m_graph->nodes.at(this->m_prev_registered_nodeID):
pose_t();
99 bool registered =
false;
101 if (this->checkRegistrationCondition(
103 this->getCurrentRobotPosEstimation())) {
104 registered = this->registerNewNodeAtEnd();
111 template<
class GRAPH_T>
126 template<
class GRAPH_T>
143 template<
class GRAPH_T>
147 parent_t::loadParams(source_fname);
149 params.loadFromConfigFileName(source_fname,
150 "NodeRegistrationDeciderParameters");
154 int min_verbosity_level =
source.read_int(
155 "NodeRegistrationDeciderParameters",
158 this->setMinLoggingLevel(VerbosityLevel(min_verbosity_level));
161 this->logFmt(LVL_DEBUG,
"Successfully loaded parameters.");
165 template<
class GRAPH_T>
168 parent_t::printParams();
174 template<
class GRAPH_T>
183 stringstream class_props_ss;
184 class_props_ss <<
"Strategy: " <<
185 "Fixed Odometry-based Intervals" << std::endl;
186 class_props_ss << header_sep << std::endl;
189 const std::string time_res = this->m_time_logger.getStatsAsText();
190 const std::string output_res = this->getLogAsString();
194 parent_t::getDescriptiveReport(report_str);
196 *report_str += class_props_ss.str();
197 *report_str += report_sep;
200 *report_str +=
params.getAsString();
201 *report_str += report_sep;
204 *report_str += time_res;
205 *report_str += report_sep;
207 *report_str += output_res;
208 *report_str += report_sep;
215 template<
class GRAPH_T>
218 template<
class GRAPH_T>
221 template<
class GRAPH_T>
225 out.
printf(
"%s", this->getAsString().c_str());
228 template<
class GRAPH_T>
236 registration_max_distance =
source.read_double( section,
237 "registration_max_distance",
239 registration_max_angle =
source.read_double( section,
240 "registration_max_angle",
242 registration_max_angle =
DEG2RAD(registration_max_angle);
247 template<
class GRAPH_T>
253 double max_angle_deg =
RAD2DEG(registration_max_angle);
257 "------------------[ Fixed Intervals Node Registration ]------------------\n";
259 "Max distance for registration = %.2f m\n", registration_max_distance);
261 "Max angle for registration = %.2f deg\n", max_angle_deg);
265 template<
class GRAPH_T>
270 this->getAsString(&str);
GRAPH_T::constraint_t::type_value pose_t
type of underlying poses (2D/3D).
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
double distanceTo(const CPoseOrPoint< OTHERCLASS > &b) const
Returns the Euclidean distance to another pose/point:
void copyFrom(const CPose3DPDF &o) MRPT_OVERRIDE
Copy operator, translating if necesary (for example, between particles and gaussian representations) ...
This class allows loading and storing values and vectors of different types from ".ini" files easily.
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.
std::string getAsString() const
double pitch() const
Get the PITCH angle (in radians)
double yaw() const
Get the YAW angle (in radians)
This class allows loading and storing values and vectors of different types from a configuration text...
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.
bool updateState(mrpt::obs::CActionCollectionPtr action, mrpt::obs::CSensoryFramePtr observations, mrpt::obs::CObservationPtr observation)
Method makes use of the CActionCollection/CObservation to update the odometry estimation from the las...
This namespace contains representation of robot actions and observations.
bool checkRegistrationCondition()
If estimated position surpasses the registration max values since the previous registered node...
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
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.
GLsizei const GLchar ** string
T wrapToPi(T a)
Modifies the given angle to translate it into the ]-pi,pi] range.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
double roll() const
Get the ROLL angle (in radians)
void loadParams(const std::string &source_fname)
Load the necessary for the decider/optimizer configuration parameters.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
const double & phi() const
Get the phi angle of the 2D pose (in radians)
#define IS_CLASS(ptrObj, class_name)
Evaluates to true if the given pointer to an object (derived from mrpt::utils::CSerializable) is of t...
GLsizei GLsizei GLchar * source
Declares a class that represents a Probability Density function (PDF) of a 3D pose ...
~CFixedIntervalsNRD()
Class destructor.
CFixedIntervalsNRD()
Class constructor.
An observation of the current (cumulative) odometry for a wheeled robot.
GLenum const GLfloat * params
void getDescriptiveReport(std::string *report_str) const
Fill the provided string with a detailed report of the decider/optimizer state.
virtual int printf(const char *fmt,...) MRPT_printf_format_check(2
Writes a string to the stream in a textual form.