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::graphs::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>
34 {
35  /**\brief Handy typedefs */
36  /**\{*/
37  /**\brief type of graph constraints */
38  using constraint_t = typename GRAPH_T::constraint_t;
39  /**\brief type of underlying poses (2D/3D). */
40  using pose_t = typename constraint_t::type_value;
42  /**\}*/
43  /**\brief Constructor */
44  THypothesis();
45  /**\brief Destructor */
46  ~THypothesis();
47  /**\brief Return a string representation of the object at hand
48  *
49  */
50  /**\{*/
51  std::string getAsString(bool oneline = true) const;
52  void getAsString(std::string* str, bool oneline = true) const;
53  /**\}*/
54 
55  /**\brief Getter methods for the underlying edge
56  *
57  * \sa setEdge
58  */
59  /**\{*/
60  void getEdge(constraint_t* edge) const;
61  constraint_t getEdge() const;
62  /**\}*/
63 
64  /**\brief Setter method for the underlying edge
65  *
66  * \sa getEdge
67  */
68  void setEdge(const constraint_t& edge);
69 
70  /**\brief Getter methods for the inverse of the underlying edge */
71  /**\{*/
72  void getInverseEdge(constraint_t* edge) const;
74  /**\}*/
75 
76  /**\brief Reverse the hypothesis.
77  *
78  * Reversing implies, at least, changing order of from/to nodes and
79  * reversing
80  * the underlying edge
81  */
82  void inverseHypothesis();
83 
84  /**\brief ID of the current hypothesis */
85  size_t id;
86  /**\brief Starting node of the hypothesis */
88  /**\brief Ending node of the hypothesis */
90  /**\brief Field that specifies if the hypothesis is to be considered */
91  bool is_valid;
92  /**\brief Goodness value corresponding to the hypothesis edge
93  *
94  * \note For ICP edges this resolves to the CICP goodness measure for the
95  * alignment operation.
96  *
97  * \sa edge, mrpt::slam::CICP::goodness
98  */
99  double goodness;
100  /**\brief Compare the start and end nodes of two hypothesis
101  *
102  * \return True if ends match.
103  */
104  bool sameEndsWith(const self_t& other) const;
105  /**\brief Check if the start, end nodes are the ones given
106  *
107  * \return True if ends are the given ones
108  */
109  bool hasEnds(
111 
112  /**\brief Handy operator for using THypothesis in std::set
113  */
114  bool operator<(const self_t& other) const;
115 
116  inline friend std::ostream& operator<<(
117  std::ostream& o, const THypothesis<GRAPH_T>& h)
118  {
119  o << h.getAsString(/*oneline=*/true) << std::endl;
120  return o;
121  }
122 
123  private:
124  /**\brief Edge connecting the two nodes */
126 };
127 }
128 #include "THypothesis_impl.h"
129 
130 #endif /* end of include guard: THYPOTHESIS_H */
131 
132 
double goodness
Goodness value corresponding to the hypothesis edge.
Definition: THypothesis.h:99
void inverseHypothesis()
Reverse the hypothesis.
typename GRAPH_T::constraint_t constraint_t
Handy typedefs.
Definition: THypothesis.h:38
bool is_valid
Field that specifies if the hypothesis is to be considered.
Definition: THypothesis.h:91
Internal functions for MRPT.
typename constraint_t::type_value pose_t
type of underlying poses (2D/3D).
Definition: THypothesis.h:40
mrpt::graphs::TNodeID from
Starting node of the hypothesis.
Definition: THypothesis.h:87
bool operator<(const self_t &other) const
Handy operator for using THypothesis in std::set.
bool hasEnds(const mrpt::graphs::TNodeID from, const mrpt::graphs::TNodeID to) const
Check if the start, end nodes are the ones given.
GLsizei const GLchar ** string
Definition: glext.h:4101
mrpt::graphs::TNodeID to
Ending node of the hypothesis.
Definition: THypothesis.h:89
void setEdge(const constraint_t &edge)
Setter method for the underlying edge.
uint64_t TNodeID
A generic numeric type for unique IDs of nodes or entities.
Definition: TNodeID.h:16
friend std::ostream & operator<<(std::ostream &o, const THypothesis< GRAPH_T > &h)
Definition: THypothesis.h:116
size_t id
ID of the current hypothesis.
Definition: THypothesis.h:85
An edge hypothesis between two nodeIDs.
Definition: THypothesis.h:33
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:125
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.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020