Main MRPT website > C++ reference for MRPT 1.9.9
TUncertaintyPath.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #ifndef TUNCERTAINTYPATH_H
11 #define TUNCERTAINTYPATH_H
12 
15 
16 #include <string>
17 
18 namespace mrpt
19 {
20 namespace graphslam
21 {
22 /**\brief Holds the data of an information path.
23  *
24  * Path comprises of nodes (TNodeID type) and constraints between them.
25  * Only consecutive nodes are connected by edges, thus \em path.
26  *
27  * \sa mrpt::deciders::CLoopCloserERD
28  * \ingroup mrpt_graphslam_grp
29  */
30 template <class GRAPH_T = typename mrpt::graphs::CNetworkOfPoses2DInf>
32 {
33  /**\brief Handy typedefs */
34  /**\{*/
35  /**\brief type of graph constraints */
36  using constraint_t = typename GRAPH_T::constraint_t;
37  /**\brief type of underlying poses (2D/3D). */
38  using pose_t = typename constraint_t::type_value;
40  /**\}*/
41 
42  // methods
43  // ////////////////////////////
45  TUncertaintyPath(const mrpt::graphs::TNodeID& starting_node);
47  const mrpt::graphs::TNodeID& starting_node,
48  const mrpt::graphs::TNodeID& ending_node, const constraint_t& edge);
50  void clear();
51  /**\return True if it is indeed empty.
52  */
53  bool isEmpty() const;
54  /**\brief Assert that the current path is between the given nodeIDs.
55  *
56  * Call to this method practically checks if the give nodes match the source
57  * and destination nodeIDs.
58  *
59  * \note Assertions will be executed only in \b Debug builds
60  *
61  * \exception std::runtime_error in case the conditions don't hold
62  */
64  const mrpt::graphs::TNodeID& from,
65  const mrpt::graphs::TNodeID& to) const;
66 
67  // no need to load anything..
68  void loadFromConfigFile(
70  const std::string& section);
71  void dumpToTextStream(std::ostream& out) const;
72  std::string getAsString() const;
73  void getAsString(std::string* str) const;
74 
75  /**\brief Return the source node of this path */
76  const mrpt::graphs::TNodeID& getSource() const;
77  /**\brief Return the Destination node of this path */
79  double getDeterminant();
80  /**\brief Test if the current path has a lower uncertainty than the other
81  * path.
82  *
83  * \return True if the current path does have a lower uncertainty
84  */
85  bool hasLowerUncertaintyThan(const self_t& other) const;
86  /**\brief add a new link in the current path.
87  *
88  * Add the node that the path traverses and the information matrix of
89  * the extra link
90  */
91  void addToPath(const mrpt::graphs::TNodeID& node, const constraint_t& edge);
92  self_t& operator+=(const self_t& other);
93  // results...
94  bool operator==(const self_t& other) const;
95  bool operator!=(const self_t& other) const;
96 
97  friend std::ostream& operator<<(std::ostream& o, const self_t& obj)
98  {
99  o << obj.getAsString() << endl;
100  return o;
101  }
102 
103  /**\brief Nodes that the Path comprises of.
104  *
105  * Nodes in the path are added to the end of the vector.
106  */
107  std::vector<mrpt::graphs::TNodeID> nodes_traversed;
108  /**\brief Current path position + corresponding covariance */
110 
111  /**Determine whether the determinant of the Path is up-to-date and
112  * can be directly fetched or has to be computed again */
113  /**\{*/
116  /**\}*/
117 };
118 }
119 } // end of namespaces
120 
121 #include "TUncertaintyPath_impl.h"
122 
123 #endif /* end of include guard: TUNCERTAINTYPATH_H */
mrpt::graphslam::TUncertaintyPath::constraint_t
typename GRAPH_T::constraint_t constraint_t
Handy typedefs.
Definition: TUncertaintyPath.h:36
CNetworkOfPoses.h
mrpt::graphslam::TUncertaintyPath::isEmpty
bool isEmpty() const
Definition: TUncertaintyPath_impl.h:74
mrpt::graphslam::TUncertaintyPath::determinant_is_updated
bool determinant_is_updated
Determine whether the determinant of the Path is up-to-date and can be directly fetched or has to be ...
Definition: TUncertaintyPath.h:114
mrpt::graphslam::TUncertaintyPath::TUncertaintyPath
TUncertaintyPath()
Definition: TUncertaintyPath_impl.h:22
mrpt::graphslam::TUncertaintyPath::getSource
const mrpt::graphs::TNodeID & getSource() const
Return the source node of this path.
Definition: TUncertaintyPath_impl.h:233
mrpt::graphslam::TUncertaintyPath::clear
void clear()
Definition: TUncertaintyPath_impl.h:49
obj
GLsizei GLsizei GLuint * obj
Definition: glext.h:4070
mrpt::graphs::TNodeID
uint64_t TNodeID
A generic numeric type for unique IDs of nodes or entities.
Definition: TNodeID.h:17
TUncertaintyPath_impl.h
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
mrpt::graphslam::TUncertaintyPath::pose_t
typename constraint_t::type_value pose_t
type of underlying poses (2D/3D).
Definition: TUncertaintyPath.h:38
mrpt::graphslam::TUncertaintyPath::getDestination
const mrpt::graphs::TNodeID & getDestination() const
Return the Destination node of this path.
Definition: TUncertaintyPath_impl.h:238
source
GLsizei GLsizei GLchar * source
Definition: glext.h:4082
mrpt::graphslam::TUncertaintyPath::addToPath
void addToPath(const mrpt::graphs::TNodeID &node, const constraint_t &edge)
add a new link in the current path.
Definition: TUncertaintyPath_impl.h:163
mrpt::graphslam::TUncertaintyPath::curr_pose_pdf
constraint_t curr_pose_pdf
Current path position + corresponding covariance.
Definition: TUncertaintyPath.h:109
mrpt::graphslam::TUncertaintyPath::operator<<
friend std::ostream & operator<<(std::ostream &o, const self_t &obj)
Definition: TUncertaintyPath.h:97
mrpt::config::CConfigFileBase
This class allows loading and storing values and vectors of different types from a configuration text...
Definition: config/CConfigFileBase.h:44
mrpt::graphslam::TUncertaintyPath::getDeterminant
double getDeterminant()
Definition: TUncertaintyPath_impl.h:244
mrpt::config::CLoadableOptions
This is a virtual base class for sets of options than can be loaded from and/or saved to configuratio...
Definition: config/CLoadableOptions.h:28
mrpt::graphslam::TUncertaintyPath::~TUncertaintyPath
~TUncertaintyPath()
Definition: TUncertaintyPath_impl.h:44
mrpt::graphslam::TUncertaintyPath::hasLowerUncertaintyThan
bool hasLowerUncertaintyThan(const self_t &other) const
Test if the current path has a lower uncertainty than the other path.
Definition: TUncertaintyPath_impl.h:273
mrpt::graphslam::TUncertaintyPath::determinant_cached
double determinant_cached
Definition: TUncertaintyPath.h:115
mrpt::graphslam::TUncertaintyPath::nodes_traversed
std::vector< mrpt::graphs::TNodeID > nodes_traversed
Nodes that the Path comprises of.
Definition: TUncertaintyPath.h:107
mrpt::graphslam::TUncertaintyPath::assertIsBetweenNodeIDs
void assertIsBetweenNodeIDs(const mrpt::graphs::TNodeID &from, const mrpt::graphs::TNodeID &to) const
Assert that the current path is between the given nodeIDs.
Definition: TUncertaintyPath_impl.h:80
CLoadableOptions.h
mrpt::graphslam::TUncertaintyPath::dumpToTextStream
void dumpToTextStream(std::ostream &out) const
This method should clearly display all the contents of the structure in textual form,...
Definition: TUncertaintyPath_impl.h:182
mrpt::graphslam::TUncertaintyPath::operator==
bool operator==(const self_t &other) const
Definition: TUncertaintyPath_impl.h:143
mrpt::graphslam::TUncertaintyPath::loadFromConfigFile
void loadFromConfigFile(const mrpt::config::CConfigFileBase &source, const std::string &section)
This method load the options from a ".ini"-like file or memory-stored string list.
Definition: TUncertaintyPath_impl.h:176
mrpt::graphslam::TUncertaintyPath::operator!=
bool operator!=(const self_t &other) const
Definition: TUncertaintyPath_impl.h:157
string
GLsizei const GLchar ** string
Definition: glext.h:4101
mrpt::graphslam::TUncertaintyPath::operator+=
self_t & operator+=(const self_t &other)
Definition: TUncertaintyPath_impl.h:96
mrpt::graphslam::TUncertaintyPath::getAsString
std::string getAsString() const
Definition: TUncertaintyPath_impl.h:225
mrpt::graphslam::TUncertaintyPath
Holds the data of an information path.
Definition: TUncertaintyPath.h:31



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