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



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