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-2017, 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 
14 #include <mrpt/math/CMatrix.h>
15 #include <mrpt/math/data_utils.h>
19 #include <mrpt/poses/CPose2D.h>
20 #include <mrpt/poses/CPose3D.h>
22 
23 #include <string>
24 #include <sstream>
25 
26 namespace mrpt
27 {
28 namespace graphslam
29 {
30 /**\brief Holds the data of an information path.
31  *
32  * Path comprises of nodes (TNodeID type) and constraints between them.
33  * Only consecutive nodes are connected by edges, thus \em path.
34  *
35  * \sa mrpt::deciders::CLoopCloserERD
36  * \ingroup mrpt_graphslam_grp
37  */
38 template <class GRAPH_T = typename mrpt::graphs::CNetworkOfPoses2DInf>
40 {
41  /**\brief Handy typedefs */
42  /**\{*/
43  /**\brief type of graph constraints */
44  typedef typename GRAPH_T::constraint_t constraint_t;
45  /**\brief type of underlying poses (2D/3D). */
46  typedef typename constraint_t::type_value pose_t;
48  /**\}*/
49 
50  // methods
51  // ////////////////////////////
53  TUncertaintyPath(const mrpt::utils::TNodeID& starting_node);
55  const mrpt::utils::TNodeID& starting_node,
56  const mrpt::utils::TNodeID& ending_node, const constraint_t& edge);
58  void clear();
59  /**\return True if it is indeed empty.
60  */
61  bool isEmpty() const;
62  /**\brief Assert that the current path is between the given nodeIDs.
63  *
64  * Call to this method practically checks if the give nodes match the source
65  * and destination nodeIDs.
66  *
67  * \exception std::runtime_error in case the conditions don't hold
68  */
70  const mrpt::utils::TNodeID& from, const mrpt::utils::TNodeID& to) const;
71 
72  // no need to load anything..
73  void loadFromConfigFile(
74  const mrpt::utils::CConfigFileBase& source, const std::string& section);
75  void dumpToTextStream(mrpt::utils::CStream& out) const;
76  std::string getAsString() const;
77  void getAsString(std::string* str) const;
78 
79  /**\brief Return the source node of this path */
80  const mrpt::utils::TNodeID& getSource() const;
81  /**\brief Return the Destination node of this path */
82  const mrpt::utils::TNodeID& getDestination() const;
83  double getDeterminant();
84  /**\brief Test if the current path has a lower uncertainty than the other
85  * path.
86  *
87  * \return True if the current path does have a lower uncertainty
88  */
89  bool hasLowerUncertaintyThan(const self_t& other) const;
90  /**\brief add a new link in the current path.
91  *
92  * Add the node that the path traverses and the information matrix of
93  * the extra link
94  */
95  void addToPath(const mrpt::utils::TNodeID& node, const constraint_t& edge);
96  self_t& operator+=(const self_t& other);
97  // results...
98  bool operator==(const self_t& other) const;
99  bool operator!=(const self_t& other) const;
100 
101  friend std::ostream& operator<<(std::ostream& o, const self_t& obj)
102  {
103  o << obj.getAsString() << endl;
104  return o;
105  }
106 
107  /**\brief Nodes that the Path comprises of.
108  *
109  * Nodes in the path are added to the end of the vector.
110  */
111  std::vector<mrpt::utils::TNodeID> nodes_traversed;
112  /**\brief Current path position + corresponding covariance */
114 
115  /**Determine whether the determinant of the Path is up-to-date and
116  * can be directly fetched or has to be computed again */
117  /**\{*/
120  /**\}*/
121 };
122 }
123 } // end of namespaces
124 
125 #include "TUncertaintyPath_impl.h"
126 
127 #endif /* end of include guard: TUNCERTAINTYPATH_H */
bool determinant_is_updated
Determine whether the determinant of the Path is up-to-date and can be directly fetched or has to be ...
std::vector< mrpt::utils::TNodeID > nodes_traversed
Nodes that the Path comprises of.
Holds the data of an information path.
void addToPath(const mrpt::utils::TNodeID &node, const constraint_t &edge)
add a new link in the current path.
GLsizei GLsizei GLuint * obj
Definition: glext.h:4070
This class allows loading and storing values and vectors of different types from a configuration text...
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:41
TUncertaintyPath< GRAPH_T > self_t
uint64_t TNodeID
The type for node IDs in graphs of different types.
constraint_t curr_pose_pdf
Current path position + corresponding covariance.
constraint_t::type_value pose_t
type of underlying poses (2D/3D).
friend std::ostream & operator<<(std::ostream &o, const self_t &obj)
GLsizei const GLchar ** string
Definition: glext.h:4101
bool hasLowerUncertaintyThan(const self_t &other) const
Test if the current path has a lower uncertainty than the other path.
void assertIsBetweenNodeIDs(const mrpt::utils::TNodeID &from, const mrpt::utils::TNodeID &to) const
Assert that the current path is between the given nodeIDs.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
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 &section)
This method load the options from a ".ini"-like file or memory-stored string list.
bool operator==(const self_t &other) const
bool operator!=(const self_t &other) const
const mrpt::utils::TNodeID & getSource() const
Return the source node of this path.
GLsizei GLsizei GLchar * source
Definition: glext.h:4082
self_t & operator+=(const self_t &other)
GRAPH_T::constraint_t constraint_t
Handy typedefs.
const mrpt::utils::TNodeID & getDestination() const
Return the Destination node of this path.
This is a virtual base class for sets of options than can be loaded from and/or saved to configuratio...



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019