Main MRPT website > C++ reference for MRPT 1.5.6
THypothesis.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-2016, 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 THYPOTHESIS_H
11 #define THYPOTHESIS_H
12 
13 #include <mrpt/poses/CPose2D.h>
14 #include <mrpt/poses/CPose3D.h>
16 
17 #include <iostream>
18 #include <string>
19 #include <sstream>
20 
21 namespace mrpt { namespace graphs{ namespace detail {
22 
23 /**\brief An edge hypothesis between two nodeIDs.
24  *
25  * Struct practically provides a wrapper around the GRAPH_T::constraint_t
26  * instance. Represents a hypothesis for a potential, perhaps loop closing,
27  * edge (i.e. a graph constraint/edge), between two nodeIDs of the graph.
28  *
29  * \sa mrpt::deciders::CLoopCloserERD
30  * \ingroup mrpt_graphs_grp
31  */
32 template<class GRAPH_T>
33 struct THypothesis {
34  /**\brief Handy typedefs */
35  /**\{*/
36  /**\brief type of graph constraints */
37  typedef typename GRAPH_T::constraint_t constraint_t;
38  /**\brief type of underlying poses (2D/3D). */
39  typedef typename constraint_t::type_value pose_t;
41  /**\}*/
42  /**\brief Constructor */
43  THypothesis();
44  /**\brief Destructor */
45  ~THypothesis();
46  /**\brief Return a string representation of the object at hand
47  *
48  */
49  /**\{*/
50  std::string getAsString(bool oneline=true) const;
51  void getAsString(std::string* str, bool oneline=true) const;
52  /**\}*/
53 
54  /**\brief Getter methods for the underlying edge
55  *
56  * \sa setEdge
57  */
58  /**\{*/
59  void getEdge(constraint_t* edge) const;
60  constraint_t getEdge() const;
61  /**\}*/
62 
63  /**\brief Setter method for the underlying edge
64  *
65  * \sa getEdge
66  */
67  void setEdge(const constraint_t& edge);
68 
69  /**\brief Getter methods for the inverse of the underlying edge */
70  /**\{*/
71  void getInverseEdge(constraint_t* edge) const;
73  /**\}*/
74 
75  /**\brief Reverse the hypothesis.
76  *
77  * Reversing implies, at least, changing order of from/to nodes and reversing
78  * the underlying edge
79  */
80  void inverseHypothesis();
81 
82  /**\brief ID of the current hypothesis */
83  size_t id;
84  /**\brief Starting node of the hypothesis */
86  /**\brief Ending node of the hypothesis */
88  /**\brief Field that specifies if the hypothesis is to be considered */
89  bool is_valid;
90  /**\brief Goodness value corresponding to the hypothesis edge
91  *
92  * \note For ICP edges this resolves to the CICP goodness measure for the
93  * alignment operation.
94  *
95  * \sa edge, mrpt::slam::CICP::goodness
96  */
97  double goodness;
98  /**\brief Compare the start and end nodes of two hypothesis
99  *
100  * \return True if ends match.
101  */
102  bool sameEndsWith(const self_t& other) const;
103  /**\brief Check if the start, end nodes are the ones given
104  *
105  * \return True if ends are the given ones
106  */
107  bool hasEnds(
109  const mrpt::utils::TNodeID to) const;
110 
111  /**\brief Handy operator for using THypothesis in std::set
112  */
113  bool operator<(const self_t& other) const;
114 
115  inline friend std::ostream& operator<<(std::ostream& o, const THypothesis<GRAPH_T>& h) {
116  o << h.getAsString(/*oneline=*/ true) << std::endl;
117  return o;
118  }
119 
120  private:
121  /**\brief Edge connecting the two nodes */
123 
124 };
125 
126 } } } // end of namespaces
127 
128 #include "THypothesis_impl.h"
129 
130 #endif /* end of include guard: THYPOTHESIS_H */
double goodness
Goodness value corresponding to the hypothesis edge.
Definition: THypothesis.h:97
void inverseHypothesis()
Reverse the hypothesis.
GRAPH_T::constraint_t constraint_t
Handy typedefs.
Definition: THypothesis.h:37
mrpt::utils::TNodeID from
Starting node of the hypothesis.
Definition: THypothesis.h:85
bool is_valid
Field that specifies if the hypothesis is to be considered.
Definition: THypothesis.h:89
uint64_t TNodeID
The type for node IDs in graphs of different types.
constraint_t::type_value pose_t
type of underlying poses (2D/3D).
Definition: THypothesis.h:39
bool operator<(const self_t &other) const
Handy operator for using THypothesis in std::set.
GLsizei const GLchar ** string
Definition: glext.h:3919
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
mrpt::utils::TNodeID to
Ending node of the hypothesis.
Definition: THypothesis.h:87
void setEdge(const constraint_t &edge)
Setter method for the underlying edge.
constraint_t getInverseEdge() const
size_t id
ID of the current hypothesis.
Definition: THypothesis.h:83
An edge hypothesis between two nodeIDs.
Definition: THypothesis.h:33
THypothesis< GRAPH_T > self_t
Definition: THypothesis.h:40
bool hasEnds(const mrpt::utils::TNodeID from, const mrpt::utils::TNodeID to) const
Check if the start, end nodes are the ones given.
bool sameEndsWith(const self_t &other) const
Compare the start and end nodes of two hypothesis.
constraint_t edge
Edge connecting the two nodes.
Definition: THypothesis.h:122
std::string getAsString(bool oneline=true) const
Return a string representation of the object at hand.



Page generated by Doxygen 1.8.14 for MRPT 1.5.6 Git: 4c65e8431 Tue Apr 24 08:18:17 2018 +0200 at lun oct 28 01:35:26 CET 2019