MRPT  2.0.4
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-2020, 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"
mrpt::graphslam::TUncertaintyPath::constraint_t
typename GRAPH_T::constraint_t constraint_t
Definition: TUncertaintyPath.h:30
CNetworkOfPoses.h
mrpt::graphslam::TUncertaintyPath::isEmpty
bool isEmpty() const
Definition: TUncertaintyPath_impl.h:66
mrpt::graphslam::TUncertaintyPath::determinant_is_updated
bool determinant_is_updated
Determine whether the determinant of the Path is up-to-date and can be directly fetched or has to be ...
Definition: TUncertaintyPath.h:102
mrpt::graphslam::TUncertaintyPath::TUncertaintyPath
TUncertaintyPath()
Definition: TUncertaintyPath_impl.h:19
mrpt::graphslam::TUncertaintyPath::getSource
const mrpt::graphs::TNodeID & getSource() const
Return the source node of this path.
Definition: TUncertaintyPath_impl.h:225
mrpt::graphslam::TUncertaintyPath::clear
void clear()
Definition: TUncertaintyPath_impl.h:41
mrpt::graphslam::TUncertaintyPath::~TUncertaintyPath
~TUncertaintyPath() override=default
mrpt::graphs::TNodeID
uint64_t TNodeID
A generic numeric type for unique IDs of nodes or entities.
Definition: TNodeID.h:16
TUncertaintyPath_impl.h
out
mrpt::vision::TStereoCalibResults out
Definition: chessboard_stereo_camera_calib_unittest.cpp:25
mrpt::graphslam::TUncertaintyPath::pose_t
typename constraint_t::type_value pose_t
Definition: TUncertaintyPath.h:31
mrpt::graphslam::TUncertaintyPath::getDestination
const mrpt::graphs::TNodeID & getDestination() const
Return the Destination node of this path.
Definition: TUncertaintyPath_impl.h:230
mrpt::graphslam
SLAM methods related to graphs of pose constraints.
Definition: TUserOptionsChecker.h:30
mrpt::graphslam::TUncertaintyPath::addToPath
void addToPath(const mrpt::graphs::TNodeID &node, const constraint_t &edge)
add a new link in the current path.
Definition: TUncertaintyPath_impl.h:155
mrpt::graphslam::TUncertaintyPath::curr_pose_pdf
constraint_t curr_pose_pdf
Current path position + corresponding covariance.
Definition: TUncertaintyPath.h:97
mrpt::graphslam::TUncertaintyPath::operator<<
friend std::ostream & operator<<(std::ostream &o, const self_t &obj)
Definition: TUncertaintyPath.h:85
mrpt::config::CConfigFileBase
This class allows loading and storing values and vectors of different types from a configuration text...
Definition: config/CConfigFileBase.h:44
mrpt::graphslam::TUncertaintyPath::getDeterminant
double getDeterminant()
Definition: TUncertaintyPath_impl.h:236
mrpt::config::CLoadableOptions
This is a virtual base class for sets of options than can be loaded from and/or saved to configuratio...
Definition: config/CLoadableOptions.h:26
mrpt::graphslam::TUncertaintyPath::hasLowerUncertaintyThan
bool hasLowerUncertaintyThan(const self_t &other) const
Test if the current path has a lower uncertainty than the other path.
Definition: TUncertaintyPath_impl.h:265
mrpt::graphslam::TUncertaintyPath::determinant_cached
double determinant_cached
Definition: TUncertaintyPath.h:103
mrpt::graphslam::TUncertaintyPath::nodes_traversed
std::vector< mrpt::graphs::TNodeID > nodes_traversed
Nodes that the Path comprises of.
Definition: TUncertaintyPath.h:95
mrpt::graphslam::TUncertaintyPath::assertIsBetweenNodeIDs
void assertIsBetweenNodeIDs(const mrpt::graphs::TNodeID &from, const mrpt::graphs::TNodeID &to) const
Assert that the current path is between the given nodeIDs.
Definition: TUncertaintyPath_impl.h:72
CLoadableOptions.h
mrpt::graphslam::TUncertaintyPath::loadFromConfigFile
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.
Definition: TUncertaintyPath_impl.h:168
mrpt::graphslam::TUncertaintyPath::operator==
bool operator==(const self_t &other) const
Definition: TUncertaintyPath_impl.h:135
mrpt::graphslam::TUncertaintyPath::operator!=
bool operator!=(const self_t &other) const
Definition: TUncertaintyPath_impl.h:149
mrpt::graphslam::TUncertaintyPath::operator+=
self_t & operator+=(const self_t &other)
Definition: TUncertaintyPath_impl.h:88
mrpt::graphslam::TUncertaintyPath::getAsString
std::string getAsString() const
Definition: TUncertaintyPath_impl.h:217
mrpt::graphslam::TUncertaintyPath::dumpToTextStream
void dumpToTextStream(std::ostream &out) const override
This method should clearly display all the contents of the structure in textual form,...
Definition: TUncertaintyPath_impl.h:174
mrpt::graphslam::TUncertaintyPath
Holds the data of an information path.
Definition: TUncertaintyPath.h:28



Page generated by Doxygen 1.8.17 for MRPT 2.0.4 at Fri Jul 17 08:43:33 UTC 2020