MRPT  1.9.9
TUncertaintyPath.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2019, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #pragma once
11 
14 
15 #include <string>
16 
17 namespace mrpt::graphslam
18 {
19 /**\brief Holds the data of an information path.
20  *
21  * Path comprises of nodes (TNodeID type) and constraints between them.
22  * Only consecutive nodes are connected by edges, thus \em path.
23  *
24  * \sa mrpt::deciders::CLoopCloserERD
25  * \ingroup mrpt_graphslam_grp
26  */
27 template <class GRAPH_T = typename mrpt::graphs::CNetworkOfPoses2DInf>
29 {
30  using constraint_t = typename GRAPH_T::constraint_t;
31  using pose_t = typename constraint_t::type_value;
33 
35  TUncertaintyPath(const mrpt::graphs::TNodeID& starting_node);
37  const mrpt::graphs::TNodeID& starting_node,
38  const mrpt::graphs::TNodeID& ending_node, const constraint_t& edge);
39  ~TUncertaintyPath() override = default;
40  void clear();
41  bool isEmpty() const;
42  /**\brief Assert that the current path is between the given nodeIDs.
43  *
44  * Call to this method practically checks if the give nodes match the source
45  * and destination nodeIDs.
46  *
47  * \note Assertions will be executed only in \b Debug builds
48  *
49  * \exception std::runtime_error in case the conditions don't hold
50  */
52  const mrpt::graphs::TNodeID& from,
53  const mrpt::graphs::TNodeID& to) const;
54 
55  // no need to load anything..
56  void loadFromConfigFile(
57  const mrpt::config::CConfigFileBase& source,
58  const std::string& section) override;
59  void dumpToTextStream(std::ostream& out) const override;
60  std::string getAsString() const;
61  void getAsString(std::string* str) const;
62 
63  /**\brief Return the source node of this path */
64  const mrpt::graphs::TNodeID& getSource() const;
65  /**\brief Return the Destination node of this path */
67  double getDeterminant();
68  /**\brief Test if the current path has a lower uncertainty than the other
69  * path.
70  *
71  * \return True if the current path does have a lower uncertainty
72  */
73  bool hasLowerUncertaintyThan(const self_t& other) const;
74  /**\brief add a new link in the current path.
75  *
76  * Add the node that the path traverses and the information matrix of
77  * the extra link
78  */
79  void addToPath(const mrpt::graphs::TNodeID& node, const constraint_t& edge);
80  self_t& operator+=(const self_t& other);
81  // results...
82  bool operator==(const self_t& other) const;
83  bool operator!=(const self_t& other) const;
84 
85  friend std::ostream& operator<<(std::ostream& o, const self_t& obj)
86  {
87  o << obj.getAsString() << endl;
88  return o;
89  }
90 
91  /**\brief Nodes that the Path comprises of.
92  *
93  * Nodes in the path are added to the end of the vector.
94  */
95  std::vector<mrpt::graphs::TNodeID> nodes_traversed;
96  /**\brief Current path position + corresponding covariance */
98 
99  /**Determine whether the determinant of the Path is up-to-date and
100  * can be directly fetched or has to be computed again */
101  /**\{*/
104  /**\}*/
105 };
106 } // namespace mrpt::graphslam
107 #include "TUncertaintyPath_impl.h"
const mrpt::graphs::TNodeID & getSource() const
Return the source node of this path.
bool determinant_is_updated
Determine whether the determinant of the Path is up-to-date and can be directly fetched or has to be ...
Holds the data of an information path.
This is a virtual base class for sets of options than can be loaded from and/or saved to configuratio...
typename constraint_t::type_value pose_t
const mrpt::graphs::TNodeID & getDestination() const
Return the Destination node of this path.
SLAM methods related to graphs of pose constraints.
This class allows loading and storing values and vectors of different types from a configuration text...
~TUncertaintyPath() override=default
constraint_t curr_pose_pdf
Current path position + corresponding covariance.
friend std::ostream & operator<<(std::ostream &o, const self_t &obj)
bool hasLowerUncertaintyThan(const self_t &other) const
Test if the current path has a lower uncertainty than the other path.
void addToPath(const mrpt::graphs::TNodeID &node, const constraint_t &edge)
add a new link in the current path.
bool operator==(const self_t &other) const
mrpt::vision::TStereoCalibResults out
bool operator!=(const self_t &other) const
uint64_t TNodeID
A generic numeric type for unique IDs of nodes or entities.
Definition: TNodeID.h:16
self_t & operator+=(const self_t &other)
std::vector< mrpt::graphs::TNodeID > nodes_traversed
Nodes that the Path comprises of.
void assertIsBetweenNodeIDs(const mrpt::graphs::TNodeID &from, const mrpt::graphs::TNodeID &to) const
Assert that the current path is between the given nodeIDs.
void loadFromConfigFile(const mrpt::config::CConfigFileBase &source, const std::string &section) override
This method load the options from a ".ini"-like file or memory-stored string list.
typename GRAPH_T::constraint_t constraint_t
void dumpToTextStream(std::ostream &out) const override
This method should clearly display all the contents of the structure in textual form, sending it to a std::ostream.



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: d1962bc6a Wed Jan 15 17:38:30 2020 +0100 at miƩ ene 15 17:45:11 CET 2020