10 #ifndef CFIXEDINTERVALSNRD_IMPL_H 11 #define CFIXEDINTERVALSNRD_IMPL_H 22 template <
class GRAPH_T>
26 this->initializeLoggers(
"CFixedIntervalsNRD");
28 this->logFmt(LVL_DEBUG,
"IntervalsNRD: Initialized class object");
30 template <
class GRAPH_T>
38 template <
class GRAPH_T>
55 m_observation_only_rawlog =
true;
62 m_curr_odometry_only_pose =
pose_t(obs_odometry->odometry);
64 LVL_DEBUG,
"Current odometry-only pose: %s",
65 m_curr_odometry_only_pose.asString().c_str());
69 this->m_since_prev_node_PDF.mean =
70 m_curr_odometry_only_pose - m_last_odometry_only_pose;
75 m_observation_only_rawlog =
false;
78 bool found = action->getFirstMovementEstimation(move_pdf);
85 this->m_since_prev_node_PDF += incr_constraint;
89 bool registered = this->checkRegistrationCondition();
93 if (m_observation_only_rawlog)
97 m_last_odometry_only_pose = m_curr_odometry_only_pose;
106 template <
class GRAPH_T>
113 pose_t last_pose_inserted =
115 ? this->m_graph->nodes.at(this->m_prev_registered_nodeID)
119 bool registered =
false;
121 if (this->checkRegistrationCondition(
122 last_pose_inserted, this->getCurrentRobotPosEstimation()))
124 registered = this->registerNewNodeAtEnd();
131 template <
class GRAPH_T>
147 template <
class GRAPH_T>
156 params.registration_max_angle) ||
158 params.registration_max_angle) ||
167 template <
class GRAPH_T>
172 parent_t::loadParams(source_fname);
174 params.loadFromConfigFileName(
175 source_fname,
"NodeRegistrationDeciderParameters");
179 int min_verbosity_level =
source.read_int(
180 "NodeRegistrationDeciderParameters",
"class_verbosity", 1,
false);
181 this->setMinLoggingLevel(VerbosityLevel(min_verbosity_level));
183 this->logFmt(LVL_DEBUG,
"Successfully loaded parameters.");
187 template <
class GRAPH_T>
191 parent_t::printParams();
197 template <
class GRAPH_T>
208 stringstream class_props_ss;
209 class_props_ss <<
"Strategy: " 210 <<
"Fixed Odometry-based Intervals" << std::endl;
211 class_props_ss << header_sep << std::endl;
214 const std::string time_res = this->m_time_logger.getStatsAsText();
215 const std::string output_res = this->getLogAsString();
219 parent_t::getDescriptiveReport(report_str);
221 *report_str += class_props_ss.str();
222 *report_str += report_sep;
225 *report_str +=
params.getAsString();
226 *report_str += report_sep;
229 *report_str += time_res;
230 *report_str += report_sep;
232 *report_str += output_res;
233 *report_str += report_sep;
240 template <
class GRAPH_T>
244 template <
class GRAPH_T>
248 template <
class GRAPH_T>
253 out.
printf(
"%s", this->getAsString().c_str());
256 template <
class GRAPH_T>
264 registration_max_distance =
source.read_double(
265 section,
"registration_max_distance", 0.5 ,
false);
266 registration_max_angle =
source.read_double(
267 section,
"registration_max_angle", 60 ,
false);
268 registration_max_angle =
DEG2RAD(registration_max_angle);
273 template <
class GRAPH_T>
281 double max_angle_deg =
RAD2DEG(registration_max_angle);
285 "------------------[ Fixed Intervals Node Registration " 286 "]------------------\n";
288 "Max distance for registration = %.2f m\n", registration_max_distance);
290 "Max angle for registration = %.2f deg\n", max_angle_deg);
294 template <
class GRAPH_T>
300 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.
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
double distanceTo(const CPoseOrPoint< OTHERCLASS > &b) const
Returns the Euclidean distance to another pose/point:
void copyFrom(const CPose3DPDF &o) 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)
std::shared_ptr< CObservationOdometry > Ptr
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.
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::shared_ptr< CSensoryFrame > Ptr
std::shared_ptr< CObservation > Ptr
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)
bool updateState(mrpt::obs::CActionCollection::Ptr action, mrpt::obs::CSensoryFrame::Ptr observations, mrpt::obs::CObservation::Ptr observation)
Method makes use of the CActionCollection/CObservation to update the odometry estimation from the las...
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.
std::shared_ptr< CActionCollection > Ptr
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.