Go to the documentation of this file.
10 #ifndef TUNCERTAINTYPATH_IMPL_H
11 #define TUNCERTAINTYPATH_IMPL_H
21 template <
class GRAPH_T>
26 template <
class GRAPH_T>
31 nodes_traversed.push_back(starting_node);
33 template <
class GRAPH_T>
39 nodes_traversed.push_back(starting_node);
40 this->addToPath(ending_node, edge);
43 template <
class GRAPH_T>
48 template <
class GRAPH_T>
57 nodes_traversed.clear();
60 curr_pose_pdf.mean =
pose_t();
65 init_path_mat *= 10000;
66 curr_pose_pdf.cov_inv = init_path_mat;
68 determinant_is_updated =
false;
69 determinant_cached = 0;
73 template <
class GRAPH_T>
79 template <
class GRAPH_T>
84 this->getSource() == from,
86 "\nnodeID %lu is not the source of the path\n%s\n\n",
87 static_cast<unsigned long>(from), this->getAsString().c_str()));
89 this->getDestination() == to,
91 "\nnodeID %lu is not the destination of the path\n%s\n\n",
92 static_cast<unsigned long>(to), this->getAsString().c_str()));
95 template <
class GRAPH_T>
107 "\"other\" instance must start from the nodeID that this "
108 "TUncertaintyPath has ended.");
111 "\"other\" instance doesn't have an initialized list of traversed "
114 this->nodes_traversed.size(),
115 "\"this\" instance doesn't have an initialized list of traversed "
128 this->nodes_traversed.insert(
139 determinant_is_updated =
false;
142 template <
class GRAPH_T>
145 using namespace mrpt;
156 template <
class GRAPH_T>
159 return !(*
this == other);
162 template <
class GRAPH_T>
167 curr_pose_pdf += edge;
170 nodes_traversed.push_back(node);
172 determinant_is_updated =
false;
175 template <
class GRAPH_T>
181 template <
class GRAPH_T>
184 out <<
mrpt::format(
"%s\n", this->getAsString().c_str());
187 template <
class GRAPH_T>
190 using namespace mrpt;
197 string header_sep(30,
'=');
199 ss <<
"Path properties: " << endl;
200 ss << header_sep << endl << endl;
202 ss <<
"- CPosePDFGaussianInf: "
203 << (curr_pose_pdf.isInfType() ?
"TRUE" :
"FALSE") << endl;
208 ss << curr_pose_pdf << endl;
212 if (curr_pose_pdf.isInfType())
214 curr_pose_pdf.getInformationMatrix(mat);
218 curr_pose_pdf.getCovariance(mat);
220 ss <<
"Determinant: " << mat.det();
224 template <
class GRAPH_T>
228 this->getAsString(&
s);
232 template <
class GRAPH_T>
235 return nodes_traversed.at(0);
237 template <
class GRAPH_T>
240 return nodes_traversed.back();
243 template <
class GRAPH_T>
246 using namespace mrpt;
252 if (determinant_is_updated)
return determinant_cached;
256 if (curr_pose_pdf.isInfType())
258 curr_pose_pdf.getInformationMatrix(mat);
262 curr_pose_pdf.getCovariance(mat);
264 double determinant = mat.det();
266 determinant_cached = determinant;
267 determinant_is_updated =
true;
272 template <
class GRAPH_T>
274 const self_t& other)
const
276 using namespace mrpt;
282 (curr_pose_pdf.isInfType() && other.
curr_pose_pdf.isInfType()) ||
283 (!curr_pose_pdf.isInfType() && !other.
curr_pose_pdf.isInfType()),
285 "Constraints of given paths don't have the same "
286 "representation of uncertainty"));
291 bool has_lower =
false;
292 if (curr_pose_pdf.isInfType())
typename GRAPH_T::constraint_t constraint_t
Handy typedefs.
void clear()
Clear the contents of this container.
std::string getSTLContainerAsString(const T &t)
Return a STL container in std::string form.
const mrpt::graphs::TNodeID & getSource() const
Return the source node of this path.
uint64_t TNodeID
A generic numeric type for unique IDs of nodes or entities.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
typename constraint_t::type_value pose_t
type of underlying poses (2D/3D).
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
const mrpt::graphs::TNodeID & getDestination() const
Return the Destination node of this path.
GLsizei GLsizei GLchar * source
void addToPath(const mrpt::graphs::TNodeID &node, const constraint_t &edge)
add a new link in the current path.
constraint_t curr_pose_pdf
Current path position + corresponding covariance.
This class allows loading and storing values and vectors of different types from a configuration text...
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
bool hasLowerUncertaintyThan(const self_t &other) const
Test if the current path has a lower uncertainty than the other path.
std::vector< mrpt::graphs::TNodeID > nodes_traversed
Nodes that the Path comprises of.
void assertIsBetweenNodeIDs(const mrpt::graphs::TNodeID &from, const mrpt::graphs::TNodeID &to) const
Assert that the current path is between the given nodeIDs.
void dumpToTextStream(std::ostream &out) const
This method should clearly display all the contents of the structure in textual form,...
#define ASSERTDEBMSG_(f, __ERROR_MSG)
bool operator==(const self_t &other) const
void loadFromConfigFile(const mrpt::config::CConfigFileBase &source, const std::string §ion)
This method load the options from a ".ini"-like file or memory-stored string list.
This base provides a set of functions for maths stuff.
bool operator!=(const self_t &other) const
GLsizei const GLchar ** string
self_t & operator+=(const self_t &other)
std::string getAsString() const
Holds the data of an information path.
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST | |